mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-18 08:00:53 +08:00
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import { Badge, Card } from 'antd';
|
|
import type { RibbonProps } from 'antd/es/badge/Ribbon';
|
|
|
|
import SemanticPreview from '../../../.dumi/theme/common/SemanticPreview';
|
|
import useLocale from '../../../.dumi/hooks/useLocale';
|
|
|
|
const locales = {
|
|
cn: {
|
|
root: '根元素',
|
|
indicator: '指示器元素',
|
|
content: '文本元素',
|
|
},
|
|
en: {
|
|
root: 'Root element',
|
|
indicator: 'Indicator element',
|
|
content: 'Text element',
|
|
},
|
|
};
|
|
|
|
const BlockList: React.FC<Readonly<RibbonProps>> = (props) => {
|
|
return (
|
|
<div style={{ width: '100%' }}>
|
|
<Badge.Ribbon {...props} text="Hippies" color="pink">
|
|
<Card title="Pushes open the window" size="small">
|
|
and raises the spyglass.
|
|
</Card>
|
|
</Badge.Ribbon>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const App: React.FC = () => {
|
|
const [locale] = useLocale(locales);
|
|
return (
|
|
<SemanticPreview
|
|
componentName="Badge"
|
|
semantics={[
|
|
{ name: 'root', desc: locale.root, version: '6.0.0' },
|
|
{ name: 'indicator', desc: locale.indicator, version: '6.0.0' },
|
|
{ name: 'content', desc: locale.content, version: '6.0.0' },
|
|
]}
|
|
>
|
|
<BlockList />
|
|
</SemanticPreview>
|
|
);
|
|
};
|
|
|
|
export default App;
|