mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-02 15:59:38 +08:00
8cd63a4d89
* test(badge): add case * fix(badge): fix `Badge` and `showZero` can't be used with custom color issue: https://github.com/ant-design/ant-design/issues/38965 * test: update snapshots * docs(badge): update demos * test: update snapshot
24 lines
676 B
TypeScript
24 lines
676 B
TypeScript
import React, { useState } from 'react';
|
|
import { ClockCircleOutlined } from '@ant-design/icons';
|
|
import { Badge, Space, Switch } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [show, setShow] = useState(true);
|
|
|
|
return (
|
|
<Space>
|
|
<Switch checked={show} onChange={() => setShow(!show)} />
|
|
<Badge count={show ? 11 : 0} showZero color='#faad14' />
|
|
<Badge count={show ? 25 : 0} />
|
|
<Badge count={show ? <ClockCircleOutlined style={{ color: '#f5222d' }} /> : 0} />
|
|
<Badge
|
|
className="site-badge-count-109"
|
|
count={show ? 109 : 0}
|
|
style={{ backgroundColor: '#52c41a' }}
|
|
/>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default App;
|