import { FC, useState } from 'react'; import { Button, Flex, Form, Input, Select, Tooltip } from 'antd'; import { useFormContext } from 'react-hook-form'; import { Schemas, useLineActionStore } from '@l-clutch/core'; import { FormValues } from '.'; type Props = { fields: any; append: (data: any) => void; }; export const ActionListFooter: FC = ({ fields, append }) => { const { watch } = useFormContext(); const background = watch('background'); const lineActionTypes = useLineActionStore((state) => state.types); const [label, setLabel] = useState(''); const [type, setType] = useState(''); const isValid = type.length > 0; const isActionLimit = fields.length >= 20; const onClick = () => { append({ bounds: { x: 0, y: 0, width: Math.round((background?.width ?? 0) / 3), height: Math.round((background?.height ?? 0) / 2), }, action: { type, label } as Schemas['LineAction'], }); }; return ( setLabel(e.target.value)} /> ); };