Skip to content

Commit 773e26a

Browse files
authored
feat: make full antd style (#22)
1 parent d1728a8 commit 773e26a

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

src/index.tsx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import type { CustomRender } from './interface';
66

77
const defaultBlackList: string[] = [
88
'ConfigProvider',
9-
'Drawer',
109
'Grid',
11-
'Modal',
12-
'Popconfirm',
13-
'Popover',
14-
'Tooltip',
15-
'Tour',
1610
];
1711

1812
const ComponentCustomizeRender: Record<
@@ -33,6 +27,40 @@ const ComponentCustomizeRender: Record<
3327
Menu: (Menu) => <Menu items={[]} />,
3428
QRCode: (QRCode) => <QRCode value="https://ant.design" />,
3529
Tree: (Tree) => <Tree treeData={[]} />,
30+
Tag: (Tag) => (
31+
<>
32+
<Tag color="blue">Tag</Tag>
33+
<Tag color="success">Tag</Tag>
34+
</>
35+
),
36+
Badge: (Badge: any) => (
37+
<>
38+
<Badge />
39+
<Badge.Ribbon />
40+
</>
41+
),
42+
Space: (Space: any) => (
43+
<>
44+
<Space />
45+
<Space.Compact>
46+
<antd.Button />
47+
</Space.Compact>
48+
</>
49+
),
50+
Modal: (Modal: any) => (
51+
<>
52+
<Modal />
53+
<Modal._InternalPanelDoNotUseOrYouWillBeFired />
54+
</>
55+
),
56+
message: (message: any) => {
57+
const { _InternalPanelDoNotUseOrYouWillBeFired: PurePanel } = message;
58+
return <PurePanel />;
59+
},
60+
notification: (notification: any) => {
61+
const { _InternalPanelDoNotUseOrYouWillBeFired: PurePanel } = notification;
62+
return <PurePanel />;
63+
},
3664
};
3765

3866
interface NodeProps {
@@ -48,7 +76,7 @@ const defaultNode = ({ excludes = [], includes }: NodeProps) => {
4876
{components
4977
.filter(
5078
(name) =>
51-
![...defaultBlackList, ...excludes].includes(name) && name[0] === name[0].toUpperCase(),
79+
![...defaultBlackList, ...excludes].includes(name) && (name[0] === name[0].toUpperCase() || ['notification', 'message'].includes(name)),
5280
)
5381
.map((compName) => {
5482
const Comp = antd[compName];

tests/index.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ describe('Static-Style-Extract', () => {
6969
excludes: ['Card']
7070
});
7171
expect(cssText).toContain('.ant-btn');
72+
expect(cssText).toContain('.ant-notification');
73+
expect(cssText).toContain('.ant-message');
7274
expect(cssText).not.toContain('.ant-card');
7375
})
7476
});

0 commit comments

Comments
 (0)