feat: migrate AlertDialog and Drawer with reviewed overlay lifecycles
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<script setup lang="ts">
|
||||
import { IconTrash } from "@tabler/icons-vue";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogBackdrop,
|
||||
AlertDialogBody,
|
||||
AlertDialogClose,
|
||||
AlertDialogCloseTrigger,
|
||||
AlertDialogContainer,
|
||||
AlertDialogDialog,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogHeading,
|
||||
AlertDialogIcon,
|
||||
AlertDialogTrigger,
|
||||
Button,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger
|
||||
class="group flex items-center gap-3 rounded-2xl bg-surface p-4 shadow-xs select-none hover:bg-surface-secondary"
|
||||
>
|
||||
<div
|
||||
class="flex size-12 shrink-0 items-center justify-center rounded-xl bg-danger-soft text-danger-soft-foreground"
|
||||
>
|
||||
<IconTrash class="size-6" aria-hidden="true" />
|
||||
</div>
|
||||
<div class="flex flex-1 flex-col gap-0.5">
|
||||
<p class="text-sm font-semibold">删除条目</p>
|
||||
<p class="text-xs text-muted">永久移除此条目</p>
|
||||
</div>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogBackdrop>
|
||||
<AlertDialogContainer>
|
||||
<AlertDialogDialog class="sm:max-w-[400px]">
|
||||
<AlertDialogCloseTrigger />
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogIcon status="danger">
|
||||
<IconTrash class="size-5" aria-hidden="true" />
|
||||
</AlertDialogIcon>
|
||||
<AlertDialogHeading>要删除此条目吗?</AlertDialogHeading>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogBody>
|
||||
<p>
|
||||
使用
|
||||
<code>AlertDialogTrigger</code>
|
||||
可在标准按钮之外自定义触发区域。此示例展示带图标与说明文字的卡片式触发器。
|
||||
</p>
|
||||
</AlertDialogBody>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogClose as-child>
|
||||
<Button variant="tertiary">取消</Button>
|
||||
</AlertDialogClose>
|
||||
<AlertDialogClose as-child>
|
||||
<Button variant="danger">删除条目</Button>
|
||||
</AlertDialogClose>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogDialog>
|
||||
</AlertDialogContainer>
|
||||
</AlertDialogBackdrop>
|
||||
</AlertDialog>
|
||||
</template>
|
||||
Reference in New Issue
Block a user