import { Field as FormikField, FieldProps } from 'formik'; import React, { forwardRef } from 'react'; import tw, { styled } from 'twin.macro'; import Input, { Textarea } from '@/components/elements/Input'; import InputError from '@/components/elements/InputError'; import Label from '@/components/elements/Label'; interface OwnProps { name: string; light?: boolean; label?: string; description?: string; validate?: (value: any) => undefined | string | Promise; className?: string; } type Props = OwnProps & Omit, 'name'>; const Field = forwardRef(({ id, name, light = false, label, description, validate, className, ...props }, ref) => ( { ({ field, form: { errors, touched } }: FieldProps) => (
{label &&
{/*{description && }*/}
} {description || null}
) }
)); Field.displayName = 'Field'; export default Field; type TextareaProps = OwnProps & Omit, 'name'>; export const TextareaField = forwardRef( function TextareaField ({ id, name, light = false, label, description, validate, className, ...props }, ref) { return ( { ({ field, form: { errors, touched } }: FieldProps) => (
{label && }