Skip to content

Commit 5967cda

Browse files
committed
fix: flag sheet
1 parent 0bc2a3e commit 5967cda

File tree

1 file changed

+39
-30
lines changed
  • apps/dashboard/app/(main)/websites/[id]/flags/_components

1 file changed

+39
-30
lines changed

apps/dashboard/app/(main)/websites/[id]/flags/_components/flag-sheet.tsx

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ import {
2828
} from "@/components/ui/select";
2929
import {
3030
Sheet,
31+
SheetBody,
3132
SheetContent,
3233
SheetDescription,
34+
SheetFooter,
3335
SheetHeader,
3436
SheetTitle,
3537
} from "@/components/ui/sheet";
@@ -222,23 +224,21 @@ export function FlagSheet({
222224

223225
return (
224226
<Sheet onOpenChange={onCloseAction} open={isOpen}>
225-
<SheetContent
226-
className="w-full overflow-y-auto p-4 sm:w-[90vw] sm:max-w-[800px] md:w-[70vw] lg:w-[30vw]"
227-
side="right"
228-
>
227+
<SheetContent side="right">
229228
<SheetHeader>
230-
<div className="flex items-center gap-3">
229+
<div className="flex items-center gap-4">
231230
<div className="flex h-11 w-11 items-center justify-center rounded border bg-secondary-brighter">
232231
<FlagIcon
233-
className="size-6 text-accent-foreground"
232+
className="text-accent-foreground"
233+
size={22}
234234
weight="fill"
235235
/>
236236
</div>
237237
<div>
238-
<SheetTitle className="font-semibold text-foreground text-xl">
238+
<SheetTitle className="text-lg">
239239
{isEditing ? "Edit Feature Flag" : "Create Feature Flag"}
240240
</SheetTitle>
241-
<SheetDescription className="mt-1 text-muted-foreground">
241+
<SheetDescription>
242242
{isEditing
243243
? "Update flag configuration and settings"
244244
: "Set up a new feature flag for controlled rollouts"}
@@ -247,11 +247,14 @@ export function FlagSheet({
247247
</div>
248248
</SheetHeader>
249249

250-
<div className="mt-5 space-y-8">
251-
<Form {...form}>
252-
<form className="space-y-8" onSubmit={form.handleSubmit(onSubmit)}>
250+
<Form {...form}>
251+
<form
252+
className="flex flex-1 flex-col overflow-y-auto"
253+
onSubmit={form.handleSubmit(onSubmit)}
254+
>
255+
<SheetBody className="space-y-6">
253256
{/* Basic Information */}
254-
<div className="space-y-5">
257+
<section className="space-y-3">
255258
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
256259
<FormField
257260
control={form.control}
@@ -337,10 +340,10 @@ export function FlagSheet({
337340
</FormItem>
338341
)}
339342
/>
340-
</div>
343+
</section>
341344

342345
{/* Configuration */}
343-
<div className="space-y-4">
346+
<section className="space-y-3">
344347
<div className="flex w-full flex-wrap gap-4">
345348
<FormField
346349
control={form.control}
@@ -439,11 +442,11 @@ export function FlagSheet({
439442
)}
440443
/>
441444
</div>
442-
</div>
445+
</section>
443446

444447
{/* Rollout Percentage */}
445448
{showRolloutPercentage && (
446-
<div className="space-y-4">
449+
<section className="space-y-3">
447450
<FormField
448451
control={form.control}
449452
name="rolloutPercentage"
@@ -497,11 +500,11 @@ export function FlagSheet({
497500
);
498501
}}
499502
/>
500-
</div>
503+
</section>
501504
)}
502505

503506
{/* User Targeting Rules */}
504-
<div className="space-y-4">
507+
<section className="space-y-3">
505508
<FormField
506509
control={form.control}
507510
name="rules"
@@ -526,19 +529,25 @@ export function FlagSheet({
526529
</FormItem>
527530
)}
528531
/>
529-
</div>
532+
</section>
533+
</SheetBody>
530534

531-
<div className="flex justify-end gap-3 border-t pt-6">
532-
<Button onClick={onCloseAction} type="button" variant="ghost">
533-
Cancel
534-
</Button>
535-
<Button disabled={isLoading} type="submit">
536-
{isLoading ? "Saving..." : isEditing ? "Update" : "Create"}
537-
</Button>
538-
</div>
539-
</form>
540-
</Form>
541-
</div>
535+
<SheetFooter>
536+
<Button onClick={onCloseAction} type="button" variant="ghost">
537+
Cancel
538+
</Button>
539+
<Button disabled={isLoading} type="submit">
540+
{isLoading
541+
? isEditing
542+
? "Updating..."
543+
: "Creating..."
544+
: isEditing
545+
? "Update Flag"
546+
: "Create Flag"}
547+
</Button>
548+
</SheetFooter>
549+
</form>
550+
</Form>
542551
</SheetContent>
543552
</Sheet>
544553
);

0 commit comments

Comments
 (0)