From 481402e09fe760634b826b09e302e2e1bfec88b1 Mon Sep 17 00:00:00 2001 From: shu Date: Mon, 7 Sep 2026 15:48:36 +0800 Subject: feat: initialize React Spectrum template with layouts and showcases --- src/components/ui-kit/navigation-data.tsx | 75 +++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/components/ui-kit/navigation-data.tsx (limited to 'src/components/ui-kit/navigation-data.tsx') diff --git a/src/components/ui-kit/navigation-data.tsx b/src/components/ui-kit/navigation-data.tsx new file mode 100644 index 0000000..5ac2605 --- /dev/null +++ b/src/components/ui-kit/navigation-data.tsx @@ -0,0 +1,75 @@ +import { useState } from 'react' +import { Tabs, TabList, Tab, TabPanel } from '@react-spectrum/s2/Tabs' +import { Accordion, AccordionItem, AccordionItemTitle, AccordionItemPanel } from '@react-spectrum/s2/Accordion' +import { Breadcrumbs, Breadcrumb } from '@react-spectrum/s2/Breadcrumbs' +import { TagGroup, Tag } from '@react-spectrum/s2/TagGroup' +import { Button } from '@react-spectrum/s2/Button' +import { Card, CardPreview, Content, Text, Footer } from '@react-spectrum/s2/Card' +import { TableView, TableHeader, Column, TableBody, Row, Cell, type Selection, type SortDescriptor } from '@react-spectrum/s2/TableView' +import { StatusLight } from '@react-spectrum/s2/StatusLight' +import EditIcon from '@react-spectrum/s2/icons/Edit' +import styles from './ui-kit.module.css' + +const initialTags = ['设计', '开发', '文档'] +const rows = [ + { id: 'buttons', name: '按钮', category: '基础操作', status: '已完成' }, + { id: 'navigation', name: '导航', category: '页面组织', status: '已完成' }, + { id: 'form', name: '表单', category: '数据输入', status: '示例' }, +] + +export default function NavigationData() { + const [tags, setTags] = useState(initialTags) + const [selection, setSelection] = useState(new Set()) + const [sort, setSort] = useState({ column: 'name', direction: 'ascending' }) + const sortedRows = [...rows].sort((a, b) => a.name.localeCompare(b.name, 'zh-CN') * (sort.direction === 'descending' ? -1 : 1)) + + return ( + <> +
+

导航与内容组织

+ HomeUI Kit + + 概览详情禁用 +

这是概览面板。点击“详情”切换内容。

+

这是详情面板。也可以使用键盘方向键切换标签。

+
+ + 组件如何交互?点击、聚焦或使用键盘体验组件的不同状态。 + 如何查看暗色效果?使用顶栏右上角的设置按钮切换亮色和暗色模式。 + +
+ +
+

标签与卡片

+ setTags((current) => current.filter((tag) => !keys.has(tag)))}> + {tags.map((tag) => {tag})} + + {tags.length === 0 &&

标签已清空。

} +
+
+ +
+ 表单组件文本输入、选择、日期、颜色与文件控件。 +
点击查看表单页面
+
+ + 内容卡片使用标题、描述和底部状态组织信息。 +
静态展示
+
+
+
+ +
+

数据表格

+

支持多选,点击“名称”可切换排序。

+
+ + 名称分类状态 + {(row) => {row.name}{row.category}{row.status}} + +
+

已选择 {selection === 'all' ? rows.length : selection.size} 项

+
+ + ) +} -- cgit v1.2.3