import MDEditor from '@uiw/react-md-editor' import React from 'react' import rehypeSanitize from 'rehype-sanitize' import '../styles/styles.css' interface InputFieldProps { label: string description?: string type?: 'text' | 'textarea' | 'richtext' placeholder: string name: string inputMode?: 'url' value: string error?: string onChange: (name: string, value: string) => void } export const InputField = React.memo( ({ label, description, type = 'text', placeholder, name, inputMode, value, error, onChange }: InputFieldProps) => { const handleChange = ( e: React.ChangeEvent ) => { onChange(name, e.target.value) } return (
{description &&

{description}

} {type === 'textarea' ? ( ) : type === 'richtext' ? ( onChange(name, content || '')} previewOptions={{ rehypePlugins: [[rehypeSanitize]] }} preview='edit' /> ) : ( )} {error && }
) } ) type InputErrorProps = { message: string } export const InputError = ({ message }: InputErrorProps) => { if (!message) return null return (

{message}

) } interface CheckboxFieldProps { label: string name: string isChecked: boolean handleChange: (e: React.ChangeEvent) => void } export const CheckboxField = React.memo( ({ label, name, isChecked, handleChange }: CheckboxFieldProps) => (
) )