feat: add handle to AlertDialog
This commit is contained in:
parent
36aeebb629
commit
8dbe361c86
|
@ -40,6 +40,7 @@ interface DialogProps {
|
||||||
description: string
|
description: string
|
||||||
actionLabel: string
|
actionLabel: string
|
||||||
actionVariant?: ButtonProps['variant']
|
actionVariant?: ButtonProps['variant']
|
||||||
|
onAction: VoidFunction
|
||||||
cancelLabel?: string
|
cancelLabel?: string
|
||||||
onOpenAutoFocus?: DialogContentProps['onOpenAutoFocus']
|
onOpenAutoFocus?: DialogContentProps['onOpenAutoFocus']
|
||||||
onCloseAutoFocus?: DialogContentProps['onCloseAutoFocus']
|
onCloseAutoFocus?: DialogContentProps['onCloseAutoFocus']
|
||||||
|
@ -51,6 +52,7 @@ const AlertDialog = (props: DialogProps) => {
|
||||||
description,
|
description,
|
||||||
actionLabel,
|
actionLabel,
|
||||||
actionVariant,
|
actionVariant,
|
||||||
|
onAction,
|
||||||
cancelLabel = 'Cancel',
|
cancelLabel = 'Cancel',
|
||||||
...contentProps
|
...contentProps
|
||||||
} = props
|
} = props
|
||||||
|
@ -77,7 +79,9 @@ const AlertDialog = (props: DialogProps) => {
|
||||||
<Button>{cancelLabel}</Button>
|
<Button>{cancelLabel}</Button>
|
||||||
</Primitive.Cancel>
|
</Primitive.Cancel>
|
||||||
<Primitive.Action asChild>
|
<Primitive.Action asChild>
|
||||||
<Button variant={actionVariant}>{actionLabel}</Button>
|
<Button variant={actionVariant} onClick={onAction}>
|
||||||
|
{actionLabel}
|
||||||
|
</Button>
|
||||||
</Primitive.Action>
|
</Primitive.Action>
|
||||||
</Actions>
|
</Actions>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue