(
values: Record<string, unknown> = {},
)
| 46 | actionLabel={p.actionLabel ?? "Delete"} |
| 47 | cancelLabel={p.cancelLabel ?? "Cancel"} |
| 48 | style={dialog} |
| 49 | /> |
| 50 | </> |
| 51 | ); |
| 52 | }; |
| 53 | |
| 54 | export const alertDialogExampleCode = ( |
| 55 | values: Record<string, unknown> = {}, |
| 56 | ): string => { |
| 57 | const title = values.title as string | undefined; |
| 58 | const description = values.description as string | undefined; |
| 59 | const actionLabel = values.actionLabel as string | undefined; |
| 60 | const cancelLabel = values.cancelLabel as string | undefined; |
| 61 | |
| 62 | const alertDialogProps: string[] = []; |
| 63 | if (title !== undefined && title !== "Delete account?") |
| 64 | alertDialogProps.push(`title="${title}"`); |
| 65 | if ( |
| 66 | description !== undefined && |
| 67 | description !== |
| 68 | "This action cannot be undone. This will permanently remove your data from our servers." |
| 69 | ) |
| 70 | alertDialogProps.push(`description="${description}"`); |
| 71 | if (actionLabel !== undefined && actionLabel !== "Delete") |
| 72 | alertDialogProps.push(`actionLabel="${actionLabel}"`); |
| 73 | if (cancelLabel !== undefined && cancelLabel !== "Cancel") |
| 74 | alertDialogProps.push(`cancelLabel="${cancelLabel}"`); |
| 75 | |
| 76 | const alertDialogPropsStr = alertDialogProps.length |
| 77 | ? ` ${alertDialogProps.join(" ")}` |
| 78 | : ""; |
| 79 | |
| 80 | return `import { AlertDialog } from "@/components/remocn/alert-dialog"; |
| 81 | import { useAlertDialogTransition } from "@/components/remocn/use-alert-dialog-transition"; |
| 82 | import { Button } from "@/components/remocn/button"; |
| 83 | import { useButtonTransition } from "@/components/remocn/use-button-transition"; |
| 84 | |
| 85 | export const Scene = () => { |
| 86 | const trigger = useButtonTransition( |
| 87 | [ |
| 88 | { at: 14, state: "hover" }, |
| 89 | { at: 26, state: "press" }, |
| 90 | ], |
| 91 | { variant: "destructive" }, |
| 92 | ); |
nothing calls this directly
no outgoing calls
no test coverage detected