Skip to content

Commit 400b3e4

Browse files
committed
feat: refactor model sizes
1 parent ab6b83b commit 400b3e4

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/components/common/modal.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,21 @@ import { CaptableLogo } from "@/components/common/logo";
1313
import { cn } from "@/lib/utils";
1414
import type { DialogProps } from "@radix-ui/react-dialog";
1515

16+
const sizes = {
17+
sm: "max-w-sm",
18+
md: "max-w-md",
19+
lg: "max-w-lg",
20+
xl: "max-w-xl",
21+
"2xl": "max-w-2xl",
22+
"3xl": "max-w-3xl",
23+
"4xl": "max-w-4xl",
24+
screen: "max-w-[96vw]",
25+
};
26+
1627
export type ModalProps = {
1728
title: string | React.ReactNode;
1829
subtitle?: string | React.ReactNode;
19-
size?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl";
30+
size?: keyof typeof sizes;
2031
trigger: React.ReactNode;
2132
children: React.ReactNode;
2233
dialogProps?: DialogProps;
@@ -36,17 +47,7 @@ const Modal = ({
3647
<Dialog {...dialogProps}>
3748
<DialogTrigger asChild>{trigger}</DialogTrigger>
3849
<DialogContent
39-
className={cn(
40-
"mb-10 mt-10 gap-0 bg-white p-0",
41-
size === "sm" && "sm:max-w-sm",
42-
size === "md" && "sm:max-w-md",
43-
size === "lg" && "sm:max-w-lg",
44-
size === "xl" && "sm:max-w-xl",
45-
size === "2xl" && "sm:max-w-2xl",
46-
size === "3xl" && "sm:max-w-3xl",
47-
size === "4xl" && "sm:max-w-4xl",
48-
size === "5xl" && "sm:max-w-5xl",
49-
)}
50+
className={cn("mb-10 mt-10 gap-0 bg-white p-0", sizes[size])}
5051
>
5152
<div
5253
className={cn(

0 commit comments

Comments
 (0)