fix: use suffix in text field (#6532)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>pull/6519/head^2
parent
24fc7d611f
commit
c78f4deaf7
|
@ -36,49 +36,37 @@ export const TimeTimeUnitInput = (props: Props) => {
|
|||
defaultValue={form.getValues("time") || 24}
|
||||
className="-mt-2 rounded-r-none text-sm focus:ring-0"
|
||||
{...form.register("time", { valueAsNumber: true })}
|
||||
addOnSuffix={
|
||||
<Dropdown>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="flex">
|
||||
<div className="mr-1 w-3/4">
|
||||
{timeUnit ? t(`${timeUnit.toLowerCase()}_timeUnit`) : "undefined"}{" "}
|
||||
</div>
|
||||
<div className="w-1/4 pt-1">
|
||||
<Icon.FiChevronDown />
|
||||
</div>
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
{timeUnitOptions.map((option, index) => (
|
||||
<DropdownMenuItem key={index} className="outline-none">
|
||||
<DropdownItem
|
||||
key={index}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setTimeUnit(option.value);
|
||||
form.setValue("timeUnit", option.value);
|
||||
}}>
|
||||
{option.label}
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Dropdown>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="-ml-1 h-9 w-24 rounded-none rounded-r-md border border-gray-300 bg-gray-50 px-3 py-1 text-sm">
|
||||
<div className="flex">
|
||||
<div className="mr-1 w-3/4">
|
||||
{timeUnit ? t(`${timeUnit.toLowerCase()}_timeUnit`) : "undefined"}{" "}
|
||||
</div>
|
||||
<div className="w-1/4 pt-1">
|
||||
<Icon.FiChevronDown />
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
{timeUnitOptions.map((option, index) => (
|
||||
<DropdownMenuItem key={index} className="outline-none">
|
||||
{/* <button
|
||||
key={index}
|
||||
type="button"
|
||||
className="h-8 w-20 justify-start pl-3 text-left text-sm"
|
||||
onClick={() => {
|
||||
setTimeUnit(option.value);
|
||||
form.setValue("timeUnit", option.value);
|
||||
}}>
|
||||
{option.label}
|
||||
</button> */}
|
||||
<DropdownItem
|
||||
key={index}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setTimeUnit(option.value);
|
||||
form.setValue("timeUnit", option.value);
|
||||
}}>
|
||||
{option.label}
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue