From 3637ae50540aa0183c2af44d873521654b2bb487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 12 Nov 2018 12:04:38 -0600 Subject: [PATCH] Update table gradient code to be more similar to chart legend gradient code (https://github.com/woocommerce/woocommerce-admin/pull/817) --- .../woocommerce-admin/client/components/table/style.scss | 6 ++++-- plugins/woocommerce-admin/client/components/table/table.js | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/woocommerce-admin/client/components/table/style.scss b/plugins/woocommerce-admin/client/components/table/style.scss index 9c7a7a0814f..648894a849f 100644 --- a/plugins/woocommerce-admin/client/components/table/style.scss +++ b/plugins/woocommerce-admin/client/components/table/style.scss @@ -144,11 +144,13 @@ width: 41px; height: 100%; background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); - visibility: hidden; + opacity: 0; + pointer-events: none; + transition: opacity 0.3s; } &.is-scrollable::after { - visibility: visible; + opacity: 1; } table { diff --git a/plugins/woocommerce-admin/client/components/table/table.js b/plugins/woocommerce-admin/client/components/table/table.js index 6dde99d1caf..2d89d3ef4c3 100644 --- a/plugins/woocommerce-admin/client/components/table/table.js +++ b/plugins/woocommerce-admin/client/components/table/table.js @@ -95,7 +95,7 @@ class Table extends Component { const table = this.container.current; const scrolledToEnd = table.scrollWidth - table.scrollLeft <= table.offsetWidth; this.setState( { - isScrollable: scrolledToEnd ? false : true, + isScrollable: ! scrolledToEnd, } ); }; @@ -110,9 +110,9 @@ class Table extends Component { rowHeader, rows, } = this.props; - const { tabIndex } = this.state; + const { isScrollable, tabIndex } = this.state; const classes = classnames( 'woocommerce-table__table', classNames, { - 'is-scrollable': this.state.isScrollable, + 'is-scrollable': isScrollable, } ); const sortedBy = query.orderby || get( find( headers, { defaultSort: true } ), 'key', false ); const sortDir = query.order || DESC;