Skip to content

Commit

Permalink
Fix: Improve Mobile Responsiveness and Layout for Edit User Form (#10359
Browse files Browse the repository at this point in the history
)
  • Loading branch information
modamaan authored Feb 4, 2025
1 parent fe44c96 commit fdf44a4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/components/Users/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default function UserForm({
/>
)}

<div className="grid grid-cols-2 gap-4">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<FormField
control={form.control}
name="first_name"
Expand Down Expand Up @@ -414,7 +414,7 @@ export default function UserForm({
)}
/>

<div className="grid grid-cols-2 gap-4">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<FormField
control={form.control}
name="password"
Expand Down Expand Up @@ -507,7 +507,7 @@ export default function UserForm({
/>
)}

<div className="grid grid-cols-2 gap-4">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<FormField
control={form.control}
name="phone_number"
Expand Down
21 changes: 18 additions & 3 deletions src/components/ui/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,28 @@ export function DatePicker({ date, onChange, disabled }: DatePickerProps) {
className={cn(
"w-full justify-start text-left font-normal",
!date && "text-gray-500",
"sm:w-auto",
)}
>
<CareIcon icon="l-calender" className="mr-2 h-4 w-4" />
{date ? format(date, "PPP") : <span>Pick a date</span>}
<CareIcon
icon="l-calender"
className="mr-0 sm:mr-2 h-4 w-4 flex-shrink-0"
/>
<span className="truncate">
{date ? (
<>
<span className="block sm:hidden">
{format(date, "MMM d, yyyy")}
</span>
<span className="hidden sm:block">{format(date, "PPP")}</span>
</>
) : (
<span>Pick a date</span>
)}
</span>
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<PopoverContent className="w-auto p-0 sm:w-64" align="start">
<Calendar
mode="single"
selected={date}
Expand Down
14 changes: 10 additions & 4 deletions src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export default function CreateScheduleTemplateSheet({
)}
/> */}

<div className="flex items-center gap-4 col-span-2 md:col-span-1">
<div className="flex items-center gap-0 sm:gap-4 col-span-2 md:col-span-1">
<FormField
control={form.control}
name={`availabilities.${index}.start_time`}
Expand Down Expand Up @@ -466,13 +466,16 @@ export default function CreateScheduleTemplateSheet({
{form.watch(`availabilities.${index}.slot_type`) ===
"appointment" && (
<>
<div className="flex items-center gap-4 col-span-2 md:col-span-1">
<div className="flex items-center gap-2 sm:gap-4 col-span-2 md:col-span-1">
<FormField
control={form.control}
name={`availabilities.${index}.slot_size_in_minutes`}
render={({ field }) => (
<FormItem className="flex-1">
<FormLabel required>
<FormLabel
required
className="whitespace-nowrap"
>
{t("schedule_slot_size_label")}
</FormLabel>
<FormControl>
Expand All @@ -497,7 +500,10 @@ export default function CreateScheduleTemplateSheet({
name={`availabilities.${index}.tokens_per_slot`}
render={({ field }) => (
<FormItem className="flex-1">
<FormLabel required>
<FormLabel
required
className="whitespace-nowrap"
>
{t("patients_per_slot")}
</FormLabel>
<FormControl>
Expand Down

0 comments on commit fdf44a4

Please sign in to comment.