type InputProps = { id: string; required: boolean; className?: string; type: 'text' | 'tel' | 'mail' | 'textarea' | 'checkbox' | 'select' | 'email'; placeholder: string; description: string; error: boolean; options?: { value: string; label: string; }[]; value: string | boolean; onChange: (value: string | boolean) => void; children?: React.ReactNode; // Slot 用法 }; export default function Ipnut({ id = '', required = false, type = 'text', placeholder = 'Placeholder', description = 'Hint Text', error = false, className = '', options = [], value = '', onChange = () => { }, children = null }: InputProps) { if (type === 'textarea') { return (

{description}

{error &&

這是錯誤提示文字

}
); } else if (type === 'select') { return ( <>

{description}

{error &&

這是錯誤提示文字

} ); } else if (type === 'checkbox') { return (
) } else if ( type === 'mail' ) { return (
onChange(e.target.value)} />

{description}

{error &&

這是錯誤提示文字

}
); } else { return (
onChange(e.target.value)} />

{description}

{error &&

這是錯誤提示文字

}
); } }