File tree Expand file tree Collapse file tree 1 file changed +14
-33
lines changed Expand file tree Collapse file tree 1 file changed +14
-33
lines changed Original file line number Diff line number Diff line change @@ -10,40 +10,21 @@ function getTabUI(props: any) {
10
10
export const Tab = ( props : any ) => {
11
11
const { icon, ...rest } = props ;
12
12
const Wrapper : any = getTabUI ;
13
- const Styled = withStyles ( props . styles ) ( Wrapper ) ;
13
+ const Styled = withStyles ( props . styles || { } ) ( Wrapper ) ;
14
14
15
- // const CustomIcon: React.ElementType = () => {
16
- // if (!icon) {
17
- // return null;
18
- // }
19
- // const size = icon.size || 24;
15
+ let iconNode ;
20
16
21
- // const iconProps = {
22
- // size,
23
- // style: {
24
- // lineHeight: size,
25
- // ...icon.style,
26
- // },
27
- // ...icon,
28
- // };
17
+ if ( React . isValidElement ( icon ) ) {
18
+ iconNode = icon ;
19
+ } else if ( ! ! icon ) {
20
+ iconNode = (
21
+ < DynamicIcon
22
+ size = { icon . size || 24 }
23
+ style = { { lineHeight : icon . size || 24 , ...icon . style } }
24
+ { ...icon }
25
+ />
26
+ ) ;
27
+ }
29
28
30
- // return <DynamicIcon {...iconProps} />;
31
- // };
32
- return (
33
- < Styled
34
- { ...rest }
35
- icon = {
36
- // <CustomIcon />
37
- icon ? (
38
- < DynamicIcon
39
- size = { icon . size || 24 }
40
- style = { { lineHeight : icon . size || 24 , ...icon . style } }
41
- { ...icon }
42
- />
43
- ) : (
44
- undefined
45
- )
46
- }
47
- />
48
- ) ;
29
+ return < Styled { ...rest } icon = { iconNode } /> ;
49
30
} ;
You can’t perform that action at this time.
0 commit comments