Skip to content

Commit

Permalink
feat(Tab): adds component.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Firsov committed Aug 13, 2019
1 parent 2b83d76 commit 325c182
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions e2e/__tests__/tab.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { baisy } from '../setup/TestSuiter';


const SUITES = [
baisy.suite('Components/Tab', 'common'),
];


SUITES.map(suite => {
it(suite.getTestName(), suite.testStory, 20000);
});

19 changes: 19 additions & 0 deletions src/components/Tab/Tab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// @flow

import React from 'react';

import { TabOuter } from './Tab.theme';

type TabProps = {
children: React$Node,
className?: string,
};

const Tab = ({ children, ...rest }: TabProps) => (
<TabOuter { ...rest }>
{ children }
</TabOuter>
);

export { Tab };

22 changes: 22 additions & 0 deletions src/components/Tab/Tab.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @flow

import React from 'react';
import { css } from 'react-emotion';

export default (asStory: *) => {
asStory('Components/Tab', module, (story, { Tab, Row }) => {
story
.add('common', () => (
<div className={ css`background-color: #F4F7F9` }>
<Row gap="xs" offsetX="lg" offsetY="lg">
<Tab tagName="div" className="active">
Active Tab
</Tab>
<Tab tagName="div">
Inactive Tab
</Tab>
</Row>
</div>
));
});
};
34 changes: 34 additions & 0 deletions src/components/Tab/Tab.theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { createThemeTag } from '../../theme/createThemeTag';

const name = 'tab';

const [TabOuter, themeTabOuter] = createThemeTag(name, () => ({
root: {
display: 'inline-flex',
justifyContent: 'center',
alignItems: 'center',
height: '32px',
padding: '6px 12px',
fontSize: '14px',
lineHeight: '20px',
color: '#323C47',
borderRadius: '5px 5px 0 0',
backgroundColor: '#FFFFFF',
cursor: 'pointer',

'&:not(.active)': {
opacity: 0.7,
borderRadius: '5px 5px 0 0',
},
},
}));

const theme = {
...themeTabOuter,
};

export {
TabOuter,
theme,
};

5 changes: 5 additions & 0 deletions src/components/Tab/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @flow

export { Tab } from './Tab';
export { theme } from './Tab.theme';

1 change: 1 addition & 0 deletions src/components/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ export { NoData } from './NoData';
export { Pagination } from './Pagination';
export { Indicator } from './Indicator';
export { Divider } from './Divider';
export { Tab } from './Tab';

2 changes: 2 additions & 0 deletions src/components/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { theme as tooltipTheme } from './Tooltip';
import { theme as topBarTheme } from './TopBar';
import { theme as treeSelectTheme } from './TreeSelect';
import { theme as dividerTheme } from './Divider';
import { theme as tabTheme } from './Tab';


export const theme = {
Expand Down Expand Up @@ -89,4 +90,5 @@ export const theme = {
...topBarTheme,
...treeSelectTheme,
...dividerTheme,
...tabTheme,
};

0 comments on commit 325c182

Please sign in to comment.