diff --git a/apps/client/src/components/ui/Select.tsx b/apps/client/src/components/ui/Select.tsx new file mode 100644 index 0000000..61afd13 --- /dev/null +++ b/apps/client/src/components/ui/Select.tsx @@ -0,0 +1,40 @@ +import { forwardRef, SelectHTMLAttributes } from 'react'; +import { clsx } from 'clsx'; + +interface SelectProps extends SelectHTMLAttributes { + label?: string; + error?: string; + hint?: string; +} + +export const Select = forwardRef( + ({ label, error, hint, className, id, children, ...props }, ref) => { + const inputId = id ?? label?.toLowerCase().replace(/\s+/g, '-'); + return ( +
+ {label && ( + + )} + + {hint && !error &&

{hint}

} + {error &&

{error}

} +
+ ); + } +); +Select.displayName = 'Select'; diff --git a/apps/client/src/components/ui/Textarea.tsx b/apps/client/src/components/ui/Textarea.tsx new file mode 100644 index 0000000..565166b --- /dev/null +++ b/apps/client/src/components/ui/Textarea.tsx @@ -0,0 +1,39 @@ +import { forwardRef, TextareaHTMLAttributes } from 'react'; +import { clsx } from 'clsx'; + +interface TextareaProps extends TextareaHTMLAttributes { + label?: string; + error?: string; + hint?: string; +} + +export const Textarea = forwardRef( + ({ label, error, hint, className, id, ...props }, ref) => { + const inputId = id ?? label?.toLowerCase().replace(/\s+/g, '-'); + return ( +
+ {label && ( + + )} +