From 7005212e151ef7c094a360595ede7f0defe10c24 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Wed, 14 Aug 2024 17:34:53 +0800 Subject: [PATCH] docs(list): add semantic dom (#50413) --- components/list/demo/_semantic.tsx | 91 ++++++++++++++++++++++++++++++ components/list/index.en-US.md | 8 ++- components/list/index.zh-CN.md | 8 ++- 3 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 components/list/demo/_semantic.tsx diff --git a/components/list/demo/_semantic.tsx b/components/list/demo/_semantic.tsx new file mode 100644 index 0000000000..89ad2ad7a8 --- /dev/null +++ b/components/list/demo/_semantic.tsx @@ -0,0 +1,91 @@ +import React from 'react'; + +import SemanticPreview from '../../../.dumi/components/SemanticPreview'; +import useLocale from '../../../.dumi/hooks/useLocale'; + +import { Avatar, List, Space } from 'antd'; +import { LikeOutlined, MessageOutlined, StarOutlined } from '@ant-design/icons'; + +const locales = { + cn: { + extra: '设置额外内容', + actions: '设置列表操作组', + }, + en: { + extra: 'set `extra` of List.Item', + actions: 'set `actions` of List.Item', + }, +}; + +const IconText = ({ icon, text }: { icon: React.FC; text: string }) => ( + + {React.createElement(icon)} + {text} + +); + +const data = Array.from({ length: 1 }).map((_, i) => ({ + href: 'https://ant.design', + title: `ant design part ${i}`, + avatar: `https://api.dicebear.com/7.x/miniavs/svg?seed=${i}`, + description: + 'Ant Design, a design language for background applications, is refined by Ant UED Team.', + content: + 'We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.', +})); + +const BlockList: React.FC = (props) => { + const divRef = React.useRef(null); + + return ( +
+ ( + , + , + , + ]} + extra={ + logo + } + > + } + title={{item.title}} + description={item.description} + /> + {item.content} + + )} + /> +
+ ); +}; + +const App: React.FC = () => { + const [locale] = useLocale(locales); + return ( + + + + ); +}; + +export default App; diff --git a/components/list/index.en-US.md b/components/list/index.en-US.md index 985c125ca4..23fc1da35a 100644 --- a/components/list/index.en-US.md +++ b/components/list/index.en-US.md @@ -78,9 +78,9 @@ More about pagination, please check [`Pagination`](/components/pagination/). | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | | actions | The actions content of list item. If `itemLayout` is `vertical`, shows the content on bottom, otherwise shows content on the far right | Array<ReactNode> | - | | -| classNames | Semantic structure className | `Record` | - | 5.18.0 | +| classNames | Semantic structure className | [`Record`](#semantic-dom) | - | 5.18.0 | | extra | The extra content of list item. If `itemLayout` is `vertical`, shows the content on right, otherwise shows content on the far right | ReactNode | - | | -| styles | Semantic DOM style | `Record` | - | 5.18.0 | +| styles | Semantic DOM style | [`Record`](#semantic-dom) | - | 5.18.0 | ### List.Item.Meta @@ -90,6 +90,10 @@ More about pagination, please check [`Pagination`](/components/pagination/). | description | The description of list item | ReactNode | - | | | title | The title of list item | ReactNode | - | | +## Semantic DOM + + + ## Design Token diff --git a/components/list/index.zh-CN.md b/components/list/index.zh-CN.md index ac23608e56..8a0ec408b3 100644 --- a/components/list/index.zh-CN.md +++ b/components/list/index.zh-CN.md @@ -81,9 +81,9 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*tBzwQ7raKX8AAA | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | actions | 列表操作组,根据 `itemLayout` 的不同,位置在卡片底部或者最右侧 | Array<ReactNode> | - | | -| classNames | 语义化结构 className | `Record` | - | 5.18.0 | +| classNames | 语义化结构 className | [`Record`](#semantic-dom) | - | 5.18.0 | | extra | 额外内容,通常用在 `itemLayout` 为 `vertical` 的情况下,展示右侧内容; `horizontal` 展示在列表元素最右侧 | ReactNode | - | | -| styles | 语义化结构 style | `Record` | - | 5.18.0 | +| styles | 语义化结构 style | [`Record`](#semantic-dom) | - | 5.18.0 | ### List.Item.Meta @@ -93,6 +93,10 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*tBzwQ7raKX8AAA | description | 列表元素的描述内容 | ReactNode | - | | | title | 列表元素的标题 | ReactNode | - | | +## Semantic DOM + + + ## 主题变量(Design Token)