mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-08 22:45:47 +00:00
* feat: remixicon * chore: update deps * chore: update icon * chore: fix issues * chore: build registry * chore: changeset * deps --------- Co-authored-by: shadcn <m@shadcn.com>
231 lines
7.5 KiB
TypeScript
231 lines
7.5 KiB
TypeScript
import {
|
|
Example,
|
|
ExampleWrapper,
|
|
} from "@/registry/bases/base/components/example"
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogMedia,
|
|
AlertDialogTitle,
|
|
AlertDialogTrigger,
|
|
} from "@/registry/bases/base/ui/alert-dialog"
|
|
import { Button } from "@/registry/bases/base/ui/button"
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogTrigger,
|
|
} from "@/registry/bases/base/ui/dialog"
|
|
import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"
|
|
|
|
export default function AlertDialogExample() {
|
|
return (
|
|
<ExampleWrapper>
|
|
<AlertDialogBasic />
|
|
<AlertDialogSmall />
|
|
<AlertDialogWithMedia />
|
|
<AlertDialogSmallWithMedia />
|
|
<AlertDialogDestructive />
|
|
<AlertDialogInDialog />
|
|
</ExampleWrapper>
|
|
)
|
|
}
|
|
|
|
function AlertDialogBasic() {
|
|
return (
|
|
<Example title="Basic" className="items-center">
|
|
<AlertDialog>
|
|
<AlertDialogTrigger
|
|
render={<Button variant="outline">Default</Button>}
|
|
/>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
This action cannot be undone. This will permanently delete your
|
|
account and remove your data from our servers.
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
<AlertDialogAction>Continue</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AlertDialogSmall() {
|
|
return (
|
|
<Example title="Small" className="items-center">
|
|
<AlertDialog>
|
|
<AlertDialogTrigger render={<Button variant="outline">Small</Button>} />
|
|
<AlertDialogContent size="sm">
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>Allow accessory to connect?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
Do you want to allow the USB accessory to connect to this device?
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Don't allow</AlertDialogCancel>
|
|
<AlertDialogAction>Allow</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AlertDialogWithMedia() {
|
|
return (
|
|
<Example title="With Media" className="items-center">
|
|
<AlertDialog>
|
|
<AlertDialogTrigger
|
|
render={<Button variant="outline">Default (Media)</Button>}
|
|
/>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogMedia>
|
|
<IconPlaceholder
|
|
lucide="BluetoothIcon"
|
|
tabler="IconBluetooth"
|
|
hugeicons="BluetoothIcon"
|
|
phosphor="BluetoothIcon"
|
|
remixicon="RiBluetoothLine"
|
|
/>
|
|
</AlertDialogMedia>
|
|
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
This will permanently delete your account and remove your data
|
|
from our servers.
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
<AlertDialogAction>Continue</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AlertDialogSmallWithMedia() {
|
|
return (
|
|
<Example title="Small With Media" className="items-center">
|
|
<AlertDialog>
|
|
<AlertDialogTrigger
|
|
render={<Button variant="outline">Small (Media)</Button>}
|
|
/>
|
|
|
|
<AlertDialogContent size="sm">
|
|
<AlertDialogHeader>
|
|
<AlertDialogMedia>
|
|
<IconPlaceholder
|
|
lucide="BluetoothIcon"
|
|
tabler="IconBluetooth"
|
|
hugeicons="BluetoothIcon"
|
|
phosphor="BluetoothIcon"
|
|
remixicon="RiBluetoothLine"
|
|
/>
|
|
</AlertDialogMedia>
|
|
<AlertDialogTitle>Allow accessory to connect?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
Do you want to allow the USB accessory to connect to this device?
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Don't allow</AlertDialogCancel>
|
|
<AlertDialogAction>Allow</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AlertDialogDestructive() {
|
|
return (
|
|
<Example title="Destructive" className="items-center">
|
|
<AlertDialog>
|
|
<AlertDialogTrigger
|
|
render={<Button variant="destructive">Delete Chat</Button>}
|
|
/>
|
|
<AlertDialogContent size="sm">
|
|
<AlertDialogHeader>
|
|
<AlertDialogMedia className="bg-destructive/10 text-destructive dark:bg-destructive/20 dark:text-destructive">
|
|
<IconPlaceholder
|
|
lucide="Trash2Icon"
|
|
tabler="IconTrash"
|
|
hugeicons="Delete02Icon"
|
|
phosphor="TrashIcon"
|
|
remixicon="RiDeleteBinLine"
|
|
/>
|
|
</AlertDialogMedia>
|
|
<AlertDialogTitle>Delete chat?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
This will permanently delete this chat conversation. View{" "}
|
|
<a href="#">Settings</a> delete any memories saved during this
|
|
chat.
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel variant="ghost">Cancel</AlertDialogCancel>
|
|
<AlertDialogAction variant="destructive">Delete</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AlertDialogInDialog() {
|
|
return (
|
|
<Example title="In Dialog" className="items-center">
|
|
<Dialog>
|
|
<DialogTrigger render={<Button variant="outline" />}>
|
|
Open Dialog
|
|
</DialogTrigger>
|
|
<DialogContent>
|
|
<DialogHeader>
|
|
<DialogTitle>Alert Dialog Example</DialogTitle>
|
|
<DialogDescription>
|
|
Click the button below to open an alert dialog.
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
<DialogFooter>
|
|
<AlertDialog>
|
|
<AlertDialogTrigger render={<Button />}>
|
|
Open Alert Dialog
|
|
</AlertDialogTrigger>
|
|
<AlertDialogContent size="sm">
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
This action cannot be undone. This will permanently delete
|
|
your account and remove your data from our servers.
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
<AlertDialogAction>Continue</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
</Example>
|
|
)
|
|
}
|