ant-design/components/steps/demo/_semantic.tsx
二货爱吃白萝卜 8db39e34a7
feat: ConfigProvider support classNames and styles for Steps (#53789)
* basic flex

* chore: style basic

* chore: status style

* chore: small size

* chore: label vertical

* chore: more style

* chore: hover disabled

* chore: variant

* chore: dot variant

* chore: max width

* chore: hover dot

* chore: update style

* chore: click style

* chore: init percent

* chore: pass detail

* chore: for progress

* chore: clean up

* chore: clean up

* chore: multiple css var

* chore: status text

* chore: status use var

* chore: fix nest

* chore: use svg

* chore: type of panel

* chore: offset support

* chore: inline offset

* chore: warning of steps

* docs: add semantic preview

* chore: semantic transition

* chore: hover

* chore: adjust style

* chore: update semantic preview

* chore: fix nav style

* chore: patch panel motion

* chore: update semantic preview

* docs: update config provider doc

* chore: fix part ts def

* chore: fix test ts

* test: update test case

* test: coverage

* chore: fix lint

* test: update test case

* test: update snapshot

* chore: adjust style

* chore: fix rtl

* docs: update design

* chore: update sctructure

* chore: update comment

* chore: clean up

* chore: clean up

* chore: cursor style

* chore: coverage

* docs: add missing part

* chore: order

* test: add test case

* chore: fix ts

* chore: clean up
2025-05-13 20:36:54 +08:00

77 lines
2.4 KiB
TypeScript

import React from 'react';
import { Flex, Steps, StepsProps } from 'antd';
import SemanticPreview from '../../../.dumi/components/SemanticPreview';
import type { SemanticPreviewInjectionProps } from '../../../.dumi/components/SemanticPreview';
import useLocale from '../../../.dumi/hooks/useLocale';
const locales = {
cn: {
root: '根元素',
item: '步骤项元素',
itemWrapper: '步骤项内裹元素',
itemIcon: '步骤项图标元素',
itemHeader: '步骤项头部元素',
itemTitle: '步骤项标题元素',
itemSubtitle: '步骤项副标题元素',
itemSection: '步骤项区域元素',
itemContent: '步骤项内容元素',
itemRail: '步骤项连接线元素',
},
en: {
root: 'Root element',
item: 'Step item element',
itemWrapper: 'Step item wrapper element',
itemIcon: 'Step item icon element',
itemHeader: 'Step item header element',
itemTitle: 'Step item title element',
itemSubtitle: 'Step item subtitle element',
itemSection: 'Step item section element',
itemContent: 'Step item content element',
itemRail: 'Step item rail element',
},
};
const sharedProps: StepsProps = {
current: 1,
style: { width: '100%' },
labelPlacement: 'vertical',
items: Array.from({ length: 3 }, (_, index) => ({
title: `Step ${index + 1}`,
subTitle: `00:0${index}`,
content: 'This is a content.',
})),
};
const Block = (props: SemanticPreviewInjectionProps) => (
<Flex vertical gap="large" style={{ width: '100%' }}>
<Steps {...sharedProps} {...props} />
<Steps {...sharedProps} {...props} type="panel" size="small" labelPlacement="horizontal" />
</Flex>
);
const App: React.FC = () => {
const [locale] = useLocale(locales);
return (
<SemanticPreview
componentName="Steps"
semantics={[
{ name: 'root', desc: locale.root },
{ name: 'item', desc: locale.item },
{ name: 'itemWrapper', desc: locale.itemWrapper },
{ name: 'itemIcon', desc: locale.itemIcon },
{ name: 'itemHeader', desc: locale.itemHeader },
{ name: 'itemTitle', desc: locale.itemTitle },
{ name: 'itemSubtitle', desc: locale.itemSubtitle },
{ name: 'itemSection', desc: locale.itemSection },
{ name: 'itemContent', desc: locale.itemContent },
{ name: 'itemRail', desc: locale.itemRail },
]}
>
<Block />
</SemanticPreview>
);
};
export default App;