-
Notifications
You must be signed in to change notification settings - Fork 227
/
index.tsx
53 lines (50 loc) · 1.31 KB
/
index.tsx
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
49
50
51
52
53
import * as React from 'react';
import TabIndicator from '../../../packages/tab-indicator/index';
import MaterialIcon from '../../../packages/material-icon';
import '../../../packages/tab-indicator/index.scss';
import './index.scss';
const Tab: React.FunctionComponent<{
children?: React.ReactElement<any>,
index: number,
active: boolean,
icon: boolean
}> = ({children, index, active, icon}) => { // eslint-disable-line react/prop-types
return (
<div className='tab'>
<span>Tab {index}</span>
<TabIndicator active={active} icon={icon}>
{children}
</TabIndicator>
</div>
);
};
const Tabs: React.FunctionComponent<{
children?: React.ReactElement<any>,
activeIndex: number
}> = ({children, activeIndex}) => { // eslint-disable-line react/prop-types
return (
<div className='tabs'>
{[1, 2, 3].map((number, index) => (
<Tab
icon={!!children}
key={index}
index={number}
active={index === activeIndex}
>
{children}
</Tab>
))}
</div>
);
};
const TabIndicatorScreenshotTest: React.FunctionComponent = () => {
return (
<div>
<Tabs activeIndex={2}>
<MaterialIcon icon='star' />
</Tabs>
<Tabs activeIndex={1} />
</div>
);
};
export default TabIndicatorScreenshotTest;