-
Notifications
You must be signed in to change notification settings - Fork 601
Expand file tree
/
Copy pathindex.tsx
More file actions
48 lines (39 loc) · 1.49 KB
/
index.tsx
File metadata and controls
48 lines (39 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import ConfigProvider from '../config-provider';
import { assignSubComponent } from '../util/component';
import type { ButtonProps, GroupProps } from './types';
import Button from './view/button';
import Group from './view/group';
const WithSubButton = assignSubComponent(Button, { Group });
export type { ButtonProps, GroupProps };
export default ConfigProvider.config(WithSubButton, {
transform: /* istanbul ignore next */ (props, deprecated) => {
if ('shape' in props) {
deprecated('shape', 'text | warning | ghost', 'Button');
const { shape, type, ...others } = props;
let newType = type;
if (
(type as string) === 'light' ||
(type as string) === 'dark' ||
(type === 'secondary' && shape === 'warning')
) {
newType = 'normal';
}
let ghost: ButtonProps['ghost'];
if (shape === 'ghost') {
ghost = (
{
primary: 'dark',
secondary: 'dark',
normal: 'light',
dark: 'dark',
light: 'light',
} as const
)[type || Button.defaultProps.type];
}
const text = shape === 'text';
const warning = shape === 'warning';
return { type: newType, ghost, text, warning, ...others };
}
return props;
},
});