Skip to content

Commit

Permalink
fix(atoms): few fixes in the Table components
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Sep 19, 2018
1 parent bead39e commit d9bd86f
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 30 deletions.
2 changes: 2 additions & 0 deletions src/atoms/Table/Table.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @flow

import { TablePlate as Plate, theme as tablePlateTheme } from './TablePlate';
import { TableHeader as Header, theme as tableHeaderTheme } from './TableHeader';
import { TableBody as Body, theme as tableBodyTheme } from './TableBody';
Expand Down
9 changes: 5 additions & 4 deletions src/atoms/Table/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React from 'react';
import { Grid } from '../Grid';
import { createStyledTag, createTheme } from '../../utils';

type TableBodyProps = {|
type TableBodyProps = {
children?: React$Node,
|};
};

const name = 'tableBody';

Expand All @@ -17,9 +17,10 @@ const theme = createTheme(name, {
},
});

const TableBodyTag = createStyledTag(name, () => ({
const TableBodyTag = createStyledTag(name, (props: *) => ({
display: 'grid',
overflowY: 'scroll',
overflowY: 'auto',
borderBottom: `1px solid ${props.theme.COLORS.LIGHT_GRAY1}`,
}));

function TableBody({
Expand Down
4 changes: 2 additions & 2 deletions src/atoms/Table/TableBodyCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import React from 'react';

import { createStyledTag, createTheme } from '../../utils';

type TableBodyCellProps = {|
type TableBodyCellProps = {
children?: React$Node,
|};
};

const name = 'tableBodyCell';

Expand Down
8 changes: 4 additions & 4 deletions src/atoms/Table/TableBodyRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React from 'react';
import { Grid } from '../Grid';
import { createStyledTag, createTheme } from '../../utils';

type TableBodyRowProps = {|
type TableBodyRowProps = {
children?: React$Node,
|};
};

const name = 'tableBodyRow';

Expand All @@ -17,9 +17,9 @@ const theme = createTheme(name, {
},
});

const TableBodyRowTag = createStyledTag(name, () => ({
const TableBodyRowTag = createStyledTag(name, (props: *) => ({
display: 'grid',
borderBottom: '1px solid #ccc',
borderBottom: `1px solid ${props.theme.COLORS.LIGHT_GRAY1}`,
height: '6rem',

'&:last-child': {
Expand Down
5 changes: 2 additions & 3 deletions src/atoms/Table/TableFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React from 'react';
import { Grid } from '../Grid';
import { createStyledTag, createTheme } from '../../utils';

type TableFooterProps = {|
type TableFooterProps = {
children?: React$Node,
|};
};

const name = 'tableFooter';

Expand All @@ -19,7 +19,6 @@ const theme = createTheme(name, {

const TableFooterTag = createStyledTag(name, () => ({
display: 'grid',
borderTop: '1px solid #ccc',
padding: '2rem',
}));

Expand Down
4 changes: 2 additions & 2 deletions src/atoms/Table/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React from 'react';
import { Grid } from '../Grid';
import { createStyledTag, createTheme } from '../../utils';

type TableHeaderProps = {|
type TableHeaderProps = {
children?: React$Node,
|};
};

const name = 'tableHeader';

Expand Down
4 changes: 2 additions & 2 deletions src/atoms/Table/TableHeaderCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import React from 'react';

import { createStyledTag, createTheme } from '../../utils';

type TableHeaderCellProps = {|
type TableHeaderCellProps = {
children?: React$Node,
|};
};

const name = 'tableHeaderCell';

Expand Down
4 changes: 2 additions & 2 deletions src/atoms/Table/TablePlate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React from 'react';
import { Grid } from '../Grid';
import { createStyledTag, createTheme } from '../../utils';

type TablePlateProps = {|
type TablePlateProps = {
children?: React$Node,
|};
};

const name = 'tablePlate';

Expand Down
2 changes: 2 additions & 0 deletions src/atoms/Table/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// @flow

export { Table, theme } from './Table';
22 changes: 11 additions & 11 deletions storybook/__tests__/__snapshots__/storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1715,10 +1715,10 @@ exports[`Storyshots ATOMS/Card default 1`] = `
flex-direction: column;
background: #FFFFFF;
color: #000000;
border-radius: .5rem;
box-shadow: 0 1px 3px 0 rgba(50,50,93,.14),0 4px 6px 0 rgba(112,157,199,.08);
position: relative;
padding: 0px;
border-radius: .5rem;
}
.emotion-0 {
Expand Down Expand Up @@ -1794,10 +1794,10 @@ exports[`Storyshots ATOMS/Card with custom offsets 1`] = `
flex-direction: column;
background: #FFFFFF;
color: #000000;
border-radius: .5rem;
box-shadow: 0 1px 3px 0 rgba(50,50,93,.14),0 4px 6px 0 rgba(112,157,199,.08);
position: relative;
padding: 0px;
border-radius: .5rem;
}
.emotion-0 {
Expand Down Expand Up @@ -1873,10 +1873,10 @@ exports[`Storyshots ATOMS/Card with scrollable body 1`] = `
flex-direction: column;
background: #FFFFFF;
color: #000000;
border-radius: .5rem;
box-shadow: 0 1px 3px 0 rgba(50,50,93,.14),0 4px 6px 0 rgba(112,157,199,.08);
position: relative;
padding: 0px;
border-radius: .5rem;
}
.emotion-0 {
Expand Down Expand Up @@ -1970,10 +1970,10 @@ exports[`Storyshots ATOMS/Card without footer 1`] = `
flex-direction: column;
background: #FFFFFF;
color: #000000;
border-radius: .5rem;
box-shadow: 0 1px 3px 0 rgba(50,50,93,.14),0 4px 6px 0 rgba(112,157,199,.08);
position: relative;
padding: 0px;
border-radius: .5rem;
}
.emotion-0 {
Expand Down Expand Up @@ -2036,10 +2036,10 @@ exports[`Storyshots ATOMS/Card without header 1`] = `
flex-direction: column;
background: #FFFFFF;
color: #000000;
border-radius: .5rem;
box-shadow: 0 1px 3px 0 rgba(50,50,93,.14),0 4px 6px 0 rgba(112,157,199,.08);
position: relative;
padding: 0px;
border-radius: .5rem;
}
.emotion-0 {
Expand Down Expand Up @@ -11947,10 +11947,10 @@ exports[`Storyshots ATOMS/Paper with header and sections 1`] = `
flex-direction: column;
background: #FFFFFF;
color: #000000;
border-radius: .5rem;
box-shadow: 0 1px 3px 0 rgba(50,50,93,.14),0 4px 6px 0 rgba(112,157,199,.08);
position: relative;
padding: 0px;
border-radius: .5rem;
}
.emotion-0 {
Expand Down Expand Up @@ -13411,7 +13411,8 @@ exports[`Storyshots ATOMS/Table table with loader 1`] = `
.emotion-9 {
display: grid;
display: grid;
overflow-y: scroll;
overflow-y: auto;
border-bottom: 1px solid #d0d7dd;
}
.emotion-11 {
Expand All @@ -13428,7 +13429,6 @@ exports[`Storyshots ATOMS/Table table with loader 1`] = `
-ms-flex-direction: column;
flex-direction: column;
display: grid;
border-top: 1px solid #ccc;
padding: 2rem;
}
Expand Down Expand Up @@ -13707,14 +13707,15 @@ exports[`Storyshots ATOMS/Table table with scroll 1`] = `
.emotion-337 {
display: grid;
display: grid;
overflow-y: scroll;
overflow-y: auto;
border-bottom: 1px solid #d0d7dd;
}
.emotion-17 {
display: grid;
grid-template-columns: repeat(6,1fr);
display: grid;
border-bottom: 1px solid #ccc;
border-bottom: 1px solid #d0d7dd;
height: 6rem;
}
Expand Down Expand Up @@ -13749,7 +13750,6 @@ exports[`Storyshots ATOMS/Table table with scroll 1`] = `
-ms-flex-direction: column;
flex-direction: column;
display: grid;
border-top: 1px solid #ccc;
padding: 2rem;
}
Expand Down

0 comments on commit d9bd86f

Please sign in to comment.