import Input from '@/components/common/Input' interface TemplateEditorProps { tipo: string config: Record onChange: (config: Record) => void } export default function TemplateEditor({ tipo, config, onChange }: TemplateEditorProps) { const handleColorChange = (key: string, value: string) => { onChange({ ...config, [key]: value }) } const handleTextChange = (key: string, value: string) => { onChange({ ...config, [key]: value }) } const renderEditorByType = () => { switch (tipo) { case 'capa': return (
handleColorChange('corPrimaria', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer" />
handleColorChange('corSecundaria', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer" />
handleTextChange('titulo', e.target.value)} placeholder="Ex: BUZIOS 7 PRODUCTION SYSTEM" /> handleTextChange('subtitulo', e.target.value)} placeholder="Ex: AR HEAD FABRICATION" /> handleTextChange('cliente', e.target.value)} placeholder="Ex: SAIPEM" /> handleTextChange('numeroDocumento', e.target.value)} placeholder="Ex: DB-B97-01_S1_VENDOR_DATABOOK" /> handleTextChange('contrato', e.target.value)} placeholder="Ex: OC 1472739" /> handleTextChange('fornecedor', e.target.value)} placeholder="Ex: ENGEMETAL" />
) case 'indice': return (
handleColorChange('corTitulo', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleColorChange('corLinha', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleTextChange('titulo', e.target.value)} placeholder="Título do índice" />
) case 'divisora': return (
handleColorChange('corPrimaria', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleColorChange('corSecundaria', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleTextChange('icone', e.target.value)} placeholder="Ex: 📑, 🔩, ⚡" maxLength={2} />
) case 'cabecalho': return (
handleColorChange('corBorda', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleTextChange('altura', e.target.value)} placeholder="60" />
) case 'rodape': return (
handleColorChange('corBorda', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleTextChange('altura', e.target.value)} placeholder="40" />
) case 'guia_estilo': return (
handleColorChange('corPrimaria', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleColorChange('corSecundaria', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleColorChange('corDestaque', e.target.value)} className="w-full h-10 rounded border border-gray-300 dark:border-gray-600 cursor-pointer bg-white dark:bg-gray-800" />
handleTextChange('fontePrincipal', e.target.value)} placeholder="Ex: Roboto, Arial" /> handleTextChange('fonteSecundaria', e.target.value)} placeholder="Ex: Open Sans, Helvetica" />
) default: return

Selecione um tipo de template

} } return (

Configurações do Template

{renderEditorByType()}
) }