-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tab-indicator): typescript (#545)
- Loading branch information
Matt Goo
committed
Dec 28, 2018
1 parent
8680796
commit 056adb5
Showing
5 changed files
with
149 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; |
Oops, something went wrong.