import { Col, InputNumber, Row } from 'antd'; import { useFormContext } from 'react-hook-form'; import { ErrorMessage, Schemas } from '@l-clutch/core'; import { FormValues } from '.'; type Props = { bounds: Schemas['RichMenuBounds']; background: Schemas['Image']; index: number; }; export const BoundsEditor = ({ bounds, background, index }: Props) => { const { formState: { errors }, setValue, } = useFormContext(); if (index === undefined || background === undefined || bounds === undefined) return null; return ( <> { if (value === null) return; setValue(`areas.${index}.bounds.x`, value, { shouldDirty: true }); }} /> { if (value === null) return; setValue(`areas.${index}.bounds.y`, value, { shouldDirty: true }); }} /> { if (value === null) return; setValue(`areas.${index}.bounds.width`, value, { shouldDirty: true }); }} /> { if (value === null) return; setValue(`areas.${index}.bounds.height`, value, { shouldDirty: true }); }} /> ); };