feat: add Typography EmptyState and Breadcrumbs

This commit is contained in:
maoyingjie
2026-10-22 13:07:13 +08:00
parent bcadbeaf8c
commit e4d817ce55
50 changed files with 3130 additions and 90 deletions
+12
View File
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
</script>
<template>
<Breadcrumbs>
<BreadcrumbsItem href="#">首页</BreadcrumbsItem>
<BreadcrumbsItem href="#">产品</BreadcrumbsItem>
<BreadcrumbsItem href="#">电子产品</BreadcrumbsItem>
<BreadcrumbsItem>笔记本电脑</BreadcrumbsItem>
</Breadcrumbs>
</template>
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
import { IconCaretRightFilled } from "@tabler/icons-vue";
</script>
<template>
<Breadcrumbs>
<template #separator>
<IconCaretRightFilled aria-hidden="true" :size="12" />
</template>
<BreadcrumbsItem href="#">首页</BreadcrumbsItem>
<BreadcrumbsItem href="#">产品</BreadcrumbsItem>
<BreadcrumbsItem href="#">电子产品</BreadcrumbsItem>
<BreadcrumbsItem>笔记本电脑</BreadcrumbsItem>
</Breadcrumbs>
</template>
@@ -0,0 +1,17 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
</script>
<template>
<Breadcrumbs class="rounded-lg bg-default-soft px-3 py-2">
<BreadcrumbsItem class="text-muted hover:text-accent" href="#">
首页
</BreadcrumbsItem>
<BreadcrumbsItem class="text-muted hover:text-accent" href="#">
产品
</BreadcrumbsItem>
<BreadcrumbsItem class="font-medium text-foreground">
笔记本电脑
</BreadcrumbsItem>
</Breadcrumbs>
</template>
+12
View File
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
</script>
<template>
<Breadcrumbs is-disabled>
<BreadcrumbsItem href="#">首页</BreadcrumbsItem>
<BreadcrumbsItem href="#">产品</BreadcrumbsItem>
<BreadcrumbsItem href="#">电子产品</BreadcrumbsItem>
<BreadcrumbsItem>笔记本电脑</BreadcrumbsItem>
</Breadcrumbs>
</template>
+10
View File
@@ -0,0 +1,10 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
</script>
<template>
<Breadcrumbs>
<BreadcrumbsItem href="#">首页</BreadcrumbsItem>
<BreadcrumbsItem>当前页面</BreadcrumbsItem>
</Breadcrumbs>
</template>
+11
View File
@@ -0,0 +1,11 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
</script>
<template>
<Breadcrumbs>
<BreadcrumbsItem href="#">首页</BreadcrumbsItem>
<BreadcrumbsItem href="#">分类</BreadcrumbsItem>
<BreadcrumbsItem>当前页面</BreadcrumbsItem>
</Breadcrumbs>
</template>
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { Breadcrumbs, BreadcrumbsItem } from "@heroui-vue/components";
</script>
<template>
<Breadcrumbs data-custom="foo">
<BreadcrumbsItem data-custom="bar">首页</BreadcrumbsItem>
<BreadcrumbsItem data-custom="bar">产品</BreadcrumbsItem>
<BreadcrumbsItem data-custom="bar">电子产品</BreadcrumbsItem>
<BreadcrumbsItem data-custom="bar">笔记本电脑</BreadcrumbsItem>
</Breadcrumbs>
</template>
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { ref } from "vue";
import { Button, EmptyState } from "@heroui-vue/components";
const showMessage = ref(true);
</script>
<template>
<div class="flex w-full max-w-md flex-col gap-3">
<div class="rounded-xl border border-border p-4">
<EmptyState>
<span v-if="showMessage">没有找到匹配的结果。</span>
</EmptyState>
</div>
<Button
class="self-start"
size="sm"
variant="secondary"
@click="showMessage = !showMessage"
>
切换内容
</Button>
</div>
</template>
@@ -0,0 +1,9 @@
<script setup lang="ts">
import { EmptyState } from "@heroui-vue/components";
</script>
<template>
<div class="w-full max-w-md rounded-xl border border-border p-4">
<EmptyState>没有找到匹配的搜索结果。</EmptyState>
</div>
</template>
@@ -0,0 +1,11 @@
<script setup lang="ts">
import { EmptyState } from "@heroui-vue/components";
</script>
<template>
<EmptyState
class="w-full max-w-md rounded-xl border border-border bg-surface-secondary p-6 text-center"
>
尚未添加任何项目。
</EmptyState>
</template>
+9
View File
@@ -0,0 +1,9 @@
<script setup lang="ts">
import { EmptyState } from "@heroui-vue/components";
</script>
<template>
<div class="w-full max-w-md rounded-xl border border-border p-4">
<EmptyState />
</div>
</template>
@@ -0,0 +1,22 @@
<script setup lang="ts">
import { Typography } from "@heroui-vue/components";
</script>
<template>
<div
class="flex max-w-md flex-col gap-2 rounded-xl border border-border/80 bg-surface-secondary p-4"
>
<Typography
class="text-xs font-medium tracking-wide text-accent uppercase"
type="body-xs"
>
更新日志
</Typography>
<Typography class="font-semibold tracking-tight text-foreground" type="h4">
更快的搜索结果
</Typography>
<Typography class="text-sm leading-relaxed text-muted" type="body-sm">
得益于改进的索引,查询现在在 200 毫秒内返回。
</Typography>
</div>
</template>
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { Typography } from "@heroui-vue/components";
</script>
<template>
<div class="flex max-w-xl flex-col gap-4">
<Typography type="h1">打造更出色的界面</Typography>
<Typography type="h2">保持语义化的排版</Typography>
<Typography type="h3">默认可组合</Typography>
<Typography type="h4">小标题</Typography>
<Typography>
HeroUI Typography 提供语义化排版类型与 as 元素多态。
</Typography>
<Typography color="muted" type="body-sm">
用于次要说明的较小弱化正文。
</Typography>
<Typography type="code">pnpm add @heroui/react</Typography>
</div>
</template>
+21
View File
@@ -0,0 +1,21 @@
<script setup lang="ts">
import {
TypographyCode,
TypographyHeading,
TypographyParagraph,
} from "@heroui-vue/components";
</script>
<template>
<div class="flex max-w-xl flex-col gap-4">
<TypographyHeading :level="1">仪表盘</TypographyHeading>
<TypographyParagraph>
便捷原语是 Typography
的薄封装,可在不学习第二套样式系统的情况下选择显式组合。
</TypographyParagraph>
<TypographyParagraph color="muted" size="sm">
Paragraph 支持 base、sm 和 xs 尺寸。
</TypographyParagraph>
<TypographyCode>TypographyCode</TypographyCode>
</div>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { TypographyProse } from "@heroui-vue/components";
</script>
<template>
<TypographyProse class="flex max-w-xl flex-col gap-3">
<h1>正文标题</h1>
<p>Prose 适用于标记已是语义化、由 HeroUI 应用默认排版节奏的写作型内容。</p>
<h2>章节标题</h2>
<p>
行内代码如
<code>as</code>
与 Typography 原语获得相同的代码样式处理。
</p>
</TypographyProse>
</template>
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { Typography } from "@heroui-vue/components";
</script>
<template>
<div class="flex max-w-xl flex-col gap-4">
<Typography type="h1" as="h2">H1 视觉样式,h2 语义元素</Typography>
<Typography as="span">
as 属性可更换底层元素,同时保留 HeroUI 的 props 与样式。
</Typography>
</div>
</template>
@@ -0,0 +1,84 @@
<script setup lang="ts">
import { Typography } from "@heroui-vue/components";
const scale = [
{
label: "h1",
meta: "36px / 600 / 1.11 / tight",
sample: "打造更出色的界面",
type: "h1",
},
{
label: "h2",
meta: "30px / 600 / 1.17 / tight",
sample: "为智能时代而生",
type: "h2",
},
{
label: "h3",
meta: "24px / 600 / 1.25 / tight",
sample: "按您的条件定价",
type: "h3",
},
{
label: "h4",
meta: "20px / 600 / 1.33 / tight",
sample: "申请创业计划",
type: "h4",
},
{
label: "h5",
meta: "18px / 600 / 1.39 / tight",
sample: "卡片标题",
type: "h5",
},
{
label: "h6",
meta: "16px / 600 / 1.50 / tight",
sample: "较小的功能标题",
type: "h6",
},
{
label: "body",
meta: "16px / 400 / 1.75",
sample: "用于文档、营销文案与描述的主要正文。",
type: "body",
},
{
label: "body-sm",
meta: "14px / 400 / 1.50",
sample: "次要正文、表格单元格、导航与侧边栏项。",
type: "body-sm",
},
{
label: "body-xs",
meta: "12px / 400 / 1.25",
sample: "说明文字、徽章、辅助文本与细则。",
type: "body-xs",
},
{
label: "code",
meta: "14px / mono",
sample: "pnpm add @heroui/react",
type: "code",
},
] as const;
</script>
<template>
<div class="flex w-full flex-col divide-y divide-border">
<div
v-for="row in scale"
:key="row.label"
class="grid grid-cols-[160px_1fr] items-center gap-8 py-5"
>
<div class="flex shrink-0 flex-col gap-0.5">
<span class="text-sm font-semibold text-foreground">
{{ row.label }}
</span>
<span class="text-xs whitespace-nowrap text-muted">{{ row.meta }}</span>
</div>
<Typography :type="row.type">{{ row.sample }}</Typography>
</div>
</div>
</template>