import React, { ChangeEvent, forwardRef } from 'react'; import './styles.scss'; type InputProps = { [x: string]: any, label?: string, type?: 'text' | 'number' , onChange?: (e: React.FormEvent) => void, error?: string, } export const Input = ({label, type = 'text', error, children, ...props }: InputProps) => { return (
{ label && ()} { error && (
{ error }
)}
) } export const ControlledInput = forwardRef(({label, type = 'text', error, children, ...props }, ref) => { return (
{ label && ()} { error && (
{ error }
)}
) }) type TextareaProps = { [x: string]: any, label?: string, rows?: number onChange?: (e: ChangeEvent) => void, error?: string, } export const Textarea = ({label, type = 'text', rows = 3, error, children, ...props }: TextareaProps) => { return (
{ label && ()}