Skip to content

Commit

Permalink
Use styled-components for StripedTable
Browse files Browse the repository at this point in the history
  • Loading branch information
swaterkamp committed Sep 18, 2018
1 parent 00a3d67 commit 13f1a73
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions gsa/src/web/components/table/stripedtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Authors:
* Björn Ricks <[email protected]>
* Steffen Waterkamp <[email protected]>
*
* Copyright:
* Copyright (C) 2016 - 2018 Greenbone Networks GmbH
Expand All @@ -21,31 +22,33 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import Table from './table.js';

import glamorous from 'glamorous';

const StripedTable = glamorous(Table, {
displayName: 'StripedTable',
})('striped-table', {
'& th, & td': {
padding: '4px',
},
'& tfoot tr': {
background: '#DDDDDD',
},

'@media screen': {
['& > tbody:nth-of-type(even), ' +
'& > tbody:only-of-type > tr:nth-of-type(even)']: {
backgroundColor: '#EEEEEE',
},
['& > tbody:not(:only-of-type):hover, ' +
'& > tbody:only-of-type > tr:hover']: {
background: '#DDDDDD',
},
},
});
import Theme from 'web/utils/theme';

import Table from './table';

import styled from 'styled-components';

const StripedTable = styled(Table)`
& th, & td {
padding: 4px;
};
& tfoot tr {
background: ${Theme.lightGray};
};
@media screen {
& > tbody:nth-of-type(even), & > tbody:only-of-type > tr:nth-of-type(even)
{
background: ${Theme.dialogGray};
};
& > tbody:not(:only-of-type):hover, & > tbody:only-of-type > tr:hover
{
background: ${Theme.lightGray};
};
};
`;

StripedTable.displayName = 'StripedTable';

export default StripedTable;

Expand Down

0 comments on commit 13f1a73

Please sign in to comment.