Skip to content

Commit

Permalink
Merge pull request #91 from bleu/time-input
Browse files Browse the repository at this point in the history
Add Time as input type
  • Loading branch information
luizakp authored Aug 20, 2024
2 parents 434ef9b + 7cd4b5a commit aa43f41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/FormBuilder/fields/DatePickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const DatePickerInput = withConditional<DatePickerInputProps>(
rules={field.required ? { required: true } : undefined}
defaultValue={field.defaultValue}
render={({ field: formField }) => (
<FormItem className="flex flex-col">
<FormItem className="flex flex-col w-full">
<FormLabel tooltip={field.tooltip}>{field.label}</FormLabel>
<Popover>
<PopoverTrigger asChild>
Expand All @@ -64,7 +64,7 @@ export const DatePickerInput = withConditional<DatePickerInputProps>(
</Button>
</FormControl>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<PopoverContent className="w-auto p-0 z-[1500]" align="start">
{/* @ts-expect-error TS(2739) FIXME: Type '{ mode: string; selected: any; onSelect: any... Remove this comment to see the full error message */}
<Calendar
mode="single"
Expand Down
7 changes: 5 additions & 2 deletions src/components/FormBuilder/fields/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import { Input } from "#/components/ui/Input";

import { withConditional } from "../withConditional";
import { BaseField } from "../types";
import { cn } from "#/lib";

export interface InputFieldProps extends BaseField {
length?: {
maximum?: number;
minimum: number; // undefined or number
};
mode: "text" | "number";
mode: "text" | "number" | "time";
type: "input";
}

Expand Down Expand Up @@ -56,7 +57,9 @@ export const InputField = withConditional<InputFieldProps>(
}
defaultValue={field.defaultValue}
render={({ field: formField }) => (
<FormItem className="w-full">
<FormItem
className={cn(field.mode === "time" ? "w-[240px]" : "w-full")}
>
<FormLabel tooltip={field.tooltip}>{field.label}</FormLabel>
<FormDescription>{field.description}</FormDescription>
<FormControl>
Expand Down

0 comments on commit aa43f41

Please sign in to comment.