import classNames from 'classnames' import * as React from 'react' import { types, Text, Plain } from 'react-bricks/frontend' import { FieldErrorsImpl, UseFormRegister } from 'react-hook-form' import blockNames from '../../blockNames' import { useAdminContext } from 'react-bricks/frontend' import { textColors } from '../../colors' export interface FormTextareaProps { register: UseFormRegister isRequired: boolean fieldName?: string errors: FieldErrorsImpl<{ [x: string]: any }> requiredError?: string columns: '1' | '2' label: types.TextValue } const FormTextarea: types.Brick = ({ fieldName = 'text area', isRequired = true, label, register, errors, requiredError, columns, }) => { const labelTextContent = typeof label === 'string' ? label : Plain.serialize(label) const { isAdmin } = useAdminContext() const registerAttributes = fieldName ? register( fieldName?.replace(/\s/g, '').toLowerCase(), //@ts-ignore { required: isRequired, } ) : {} return (