Skip to content

Commit ddb88f4

Browse files
committed
fix(AlertDialog): no actions state
1 parent 4053985 commit ddb88f4

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

.changeset/proud-suits-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Do not render the footer in AlertDialog if all button props are falsy'

src/components/overlays/AlertDialog/AlertDialog.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,22 @@ function AlertDialog(props: CubeAlertDialogProps, ref) {
8282
)}
8383
</Content>
8484
) : null}
85-
{!noActions ? (
85+
{!noActions || (!confirmProps && !secondaryProps && !cancelProps) ? (
8686
<Footer>
8787
<ButtonGroup align="end">
88-
<Button
89-
autoFocus
90-
theme={danger ? 'danger' : undefined}
91-
{...confirmProps}
92-
onPress={(e) =>
93-
chain(
94-
(confirmProps as CubeButtonProps)?.onPress?.(e),
95-
onClose?.('confirm'),
96-
)
97-
}
98-
/>
88+
{confirmProps && (
89+
<Button
90+
autoFocus
91+
theme={danger ? 'danger' : undefined}
92+
{...confirmProps}
93+
onPress={(e) =>
94+
chain(
95+
(confirmProps as CubeButtonProps)?.onPress?.(e),
96+
onClose?.('confirm'),
97+
)
98+
}
99+
/>
100+
)}
99101
{secondaryProps && (
100102
<Button
101103
{...secondaryProps}

0 commit comments

Comments
 (0)