import { useState } from "react"; import type { UseFormReturn } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownItem, DropdownMenuTrigger, TextField, } from "@calcom/ui"; import { ChevronDown } from "@calcom/ui/components/icon"; import { getWorkflowTimeUnitOptions } from "../lib/getOptions"; import type { FormValues } from "../pages/workflow"; type Props = { form: UseFormReturn; }; export const TimeTimeUnitInput = (props: Props) => { const { form } = props; const { t } = useLocale(); const timeUnitOptions = getWorkflowTimeUnitOptions(t); const [timeUnit, setTimeUnit] = useState(form.getValues("timeUnit")); return (
{timeUnitOptions.map((option, index) => ( { setTimeUnit(option.value); form.setValue("timeUnit", option.value); }}> {option.label} ))} } />
); };