feat: migrate AlertDialog and Drawer with reviewed overlay lifecycles
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
IconBell,
|
||||
IconHome,
|
||||
IconMail,
|
||||
IconMenu2,
|
||||
IconSearch,
|
||||
IconSettings,
|
||||
IconUser,
|
||||
} from "@tabler/icons-vue";
|
||||
import {
|
||||
Button,
|
||||
Drawer,
|
||||
DrawerBackdrop,
|
||||
DrawerBody,
|
||||
DrawerCloseTrigger,
|
||||
DrawerContent,
|
||||
DrawerDialog,
|
||||
DrawerHeader,
|
||||
DrawerHeading,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const navItems = [
|
||||
{ icon: IconHome, label: "首页" },
|
||||
{ icon: IconSearch, label: "搜索" },
|
||||
{ icon: IconBell, label: "通知" },
|
||||
{ icon: IconMail, label: "消息" },
|
||||
{ icon: IconUser, label: "个人资料" },
|
||||
{ icon: IconSettings, label: "设置" },
|
||||
] as const;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Drawer>
|
||||
<Button variant="secondary">
|
||||
<IconMenu2 aria-hidden="true" class="size-4" />
|
||||
菜单
|
||||
</Button>
|
||||
<DrawerBackdrop>
|
||||
<DrawerContent placement="left">
|
||||
<DrawerDialog>
|
||||
<DrawerCloseTrigger />
|
||||
<DrawerHeader>
|
||||
<DrawerHeading>导航</DrawerHeading>
|
||||
</DrawerHeader>
|
||||
<DrawerBody>
|
||||
<nav class="flex flex-col gap-1">
|
||||
<button
|
||||
v-for="item in navItems"
|
||||
:key="item.label"
|
||||
class="flex items-center gap-3 rounded-xl px-3 py-2.5 text-sm text-foreground transition-colors hover:bg-default"
|
||||
type="button"
|
||||
>
|
||||
<component
|
||||
:is="item.icon"
|
||||
class="size-5 text-muted"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</nav>
|
||||
</DrawerBody>
|
||||
</DrawerDialog>
|
||||
</DrawerContent>
|
||||
</DrawerBackdrop>
|
||||
</Drawer>
|
||||
</template>
|
||||
Reference in New Issue
Block a user