ant-design/components/badge/demo/no-wrapper.tsx
Wuxh 8cd63a4d89
fix(badge): fix Badge and showZero can't be used with custom color (#38967)
* 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
2022-11-24 23:53:22 +08:00

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;