Skip to content

Commit

Permalink
feat(NoData): adds NoData component
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Firsov committed Mar 6, 2019
1 parent 7653928 commit ee8dde3
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 48 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__/no-data.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/NoData', 'default'),
];


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

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

import React from 'react';

import { Icon } from '../Icon';
import { Column } from '../FlexLayout';
import {
NoDataIconContainerTag,
NoDataTextTag,
} from './NoData.theme';

const NoData = (props: *) => (
<Column stretch justifyContent="center" alignItems="center" gap="lg" offsetY="lg">
<NoDataIconContainerTag modifiers={ props }>
<Icon size="stretch" name="DismissData" color="LIGHT_GRAY1" />
</NoDataIconContainerTag>
<NoDataTextTag modifiers={ props }>no data</NoDataTextTag>
</Column>
);

export { NoData };

11 changes: 11 additions & 0 deletions src/components/NoData/NoData.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

export default (asStory) => {
asStory('Components/NoData', module, (story, { NoData }) => {
story
.add('default', () => (
<NoData />
));
});
};

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

import { createThemeTag } from '../../theme/createThemeTag';

const name = 'noData';

const [NoDataIconContainerTag, themeIconContainer] = createThemeTag(
`${name}IconContainer`,
{
root: {
height: '80px',
},
},
);

const [NoDataTextTag, themeText] = createThemeTag(
`${name}Text`,
({ COLORS }: *) => ({
root: {
color: COLORS.DISABLED_TEXT_COLOR,
fontSize: '32px',
fontWeight: 500,
textTransform: 'uppercase',
},
}),
);

const theme = {
...themeIconContainer,
...themeText,
};

export {
NoDataIconContainerTag,
NoDataTextTag,
theme,
};

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

import { NoData } from './NoData';
import { theme } from './NoData.theme';

export { NoData, theme };

2 changes: 0 additions & 2 deletions src/components/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { createThemeTag } from '../../theme/createThemeTag';


import { theme as tableActionTheme } from './TableAction';
import { theme as tableNoDataTheme } from './TableNoData';
import { TableHeader, theme as tableHeaderTheme } from './TableHeader';
import { TableBody, theme as tableBodyTheme } from './TableBody';
import { TableBodyRow, theme as tableBodyRowTheme } from './TableBodyRow';
Expand All @@ -28,7 +27,6 @@ const [TableTag, tableTheme] = createThemeTag(name, {
const theme = {
...tableTheme,
...tableActionTheme,
...tableNoDataTheme,
...tableHeaderTheme,
...tableBodyTheme,
...tableBodyRowTheme,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Table/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { PureComponent } from 'react';

import { AsyncContent } from '../AsyncContent';
import { TableNoData } from './TableNoData';
import { NoData } from '../NoData';
import { TableAction } from './TableAction';
import { Grid } from '../Grid';
import { Button } from '../Button';
Expand Down Expand Up @@ -81,7 +81,7 @@ class TableBody extends PureComponent<TableBodyProps<*>> {
{ React.Children.toArray(data && children && data.map(children)) }
</TableBodyInnerTag>
)
: <TableNoData />
: <NoData />
}
</AsyncContent>
{ this.renderTableAction() }
Expand Down
44 changes: 0 additions & 44 deletions src/components/Table/TableNoData.js

This file was deleted.

2 changes: 2 additions & 0 deletions src/components/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ export { Text } from './Text';
export { TextArea } from './TextArea';
export { TextAreaField } from './TextAreaField';
export { Tooltip } from './Tooltip';
export { NoData } from './NoData';

2 changes: 2 additions & 0 deletions src/components/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { theme as textTheme } from './Text';
import { theme as tooltipTheme } from './Tooltip';
import { theme as menuTheme } from './Menu';
import { theme as dateInputTheme } from './DateInput';
import { theme as noDataTheme } from './NoData';


export const theme = {
Expand Down Expand Up @@ -73,4 +74,5 @@ export const theme = {
...tooltipTheme,
...menuTheme,
...dateInputTheme,
...noDataTheme,
};

0 comments on commit ee8dde3

Please sign in to comment.