From 13f1a7349b837da4f12f7a2e69beb14e83ab5e4f Mon Sep 17 00:00:00 2001 From: Steffen Waterkamp Date: Tue, 18 Sep 2018 14:36:41 +0200 Subject: [PATCH] Use styled-components for StripedTable --- gsa/src/web/components/table/stripedtable.js | 53 +++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/gsa/src/web/components/table/stripedtable.js b/gsa/src/web/components/table/stripedtable.js index 3d733e60f2..8066403313 100644 --- a/gsa/src/web/components/table/stripedtable.js +++ b/gsa/src/web/components/table/stripedtable.js @@ -2,6 +2,7 @@ * * Authors: * Björn Ricks + * Steffen Waterkamp * * Copyright: * Copyright (C) 2016 - 2018 Greenbone Networks GmbH @@ -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;