Skip to content

Commit 7469444

Browse files
fix: align confirmation dialog header and footer (calcom#29588)
Signed-off-by: Chayan Das <daschayan8837@gmail.com> Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
1 parent 1599dfd commit 7469444

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

packages/ui/components/dialog/Dialog.tsx

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,10 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
9898
</div>
9999
)}
100100
{type === "confirmation" && (
101-
<div className="flex">
102-
{icon && (
103-
<div className="bg-emphasis flex h-10 w-10 shrink-0 items-center justify-center rounded-full">
104-
<Icon name={icon} className="text-emphasis h-4 w-4" />
105-
</div>
106-
)}
107-
<div className="ml-4 grow">
108-
<DialogHeader title={title} subtitle={props.description} />
109-
<div data-testid="dialog-confirmation">{children}</div>
101+
<div>
102+
<DialogHeader title={title} subtitle={props.description} icon={icon} />
103+
<div data-testid="dialog-confirmation" className="flex flex-col">
104+
{children}
110105
</div>
111106
</div>
112107
)}
@@ -120,24 +115,34 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
120115
type DialogHeaderProps = {
121116
title: React.ReactNode;
122117
subtitle?: React.ReactNode;
118+
icon?: IconName;
123119
} & React.HTMLAttributes<HTMLDivElement>;
124120

125121
export function DialogHeader(props: DialogHeaderProps) {
126122
if (!props.title) return null;
127123

128124
return (
129125
<div className="mb-4">
130-
<h2
131-
data-testid="dialog-title"
132-
className="text-semibold text-emphasis font-cal mb-1 text-xl"
133-
id="modal-title">
134-
{props.title}
135-
</h2>
136-
{props.subtitle && (
137-
<p className="text-subtle text-sm" data-testid="dialog-subtitle">
138-
{props.subtitle}
139-
</p>
140-
)}
126+
<div className={classNames("flex gap-2", props.subtitle ? "items-start" : "items-center")}>
127+
{props.icon && (
128+
<div className="bg-emphasis flex h-10 w-10 shrink-0 items-center justify-center rounded-full">
129+
<Icon name={props.icon} className="text-emphasis h-4 w-4" />
130+
</div>
131+
)}
132+
<div>
133+
<h2
134+
data-testid="dialog-title"
135+
className="text-semibold text-emphasis font-cal text-xl"
136+
id="modal-title">
137+
{props.title}
138+
</h2>
139+
{props.subtitle && (
140+
<p className="text-subtle text-sm" data-testid="dialog-subtitle">
141+
{props.subtitle}
142+
</p>
143+
)}
144+
</div>
145+
</div>
141146
</div>
142147
);
143148
}
@@ -198,4 +203,4 @@ export function DialogClose(
198203
</Button>
199204
</DialogPrimitive.Close>
200205
);
201-
}
206+
}

0 commit comments

Comments
 (0)