(p: AlertDialogExampleProps = {})
| 17 | description?: string; |
| 18 | actionLabel?: string; |
| 19 | cancelLabel?: string; |
| 20 | } |
| 21 | |
| 22 | export const AlertDialogExampleScene = (p: AlertDialogExampleProps = {}) => { |
| 23 | // The trigger Button: idle → hover → press, the press lands just before the |
| 24 | // dialog opens (the "click" that triggers it). |
| 25 | const trigger = useButtonTransition( |
| 26 | [ |
| 27 | { at: 14, state: "hover" }, |
| 28 | { at: 26, state: "press" }, |
| 29 | ], |
| 30 | { variant: "destructive" }, |
| 31 | ); |
| 32 | // The dialog opens right after the press, then closes near the end. |
| 33 | const dialog = useAlertDialogTransition([ |
| 34 | { at: 32, state: "opened", duration: 16 }, |
| 35 | { at: 92, state: "closed", duration: 12 }, |
| 36 | ]); |
| 37 | return ( |
| 38 | <> |
| 39 | <Button label="Delete account" variant="destructive" style={trigger} /> |
| 40 | <AlertDialog |
| 41 | title={p.title ?? "Delete account?"} |
| 42 | description={ |
| 43 | p.description ?? |
| 44 | "This action cannot be undone. This will permanently remove your data from our servers." |
| 45 | } |
| 46 | actionLabel={p.actionLabel ?? "Delete"} |
| 47 | cancelLabel={p.cancelLabel ?? "Cancel"} |
| 48 | style={dialog} |
| 49 | /> |
nothing calls this directly
no test coverage detected