Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Decrease product list's opacity while sorting options are changing

weronka0126696fce57
diff --git a/saleor/static/js/components/categoryPage/CategoryPage.js b/saleor/static/js/components/categoryPage/CategoryPage.js
index 8e1ca9526c..1e390fa14a 100644
--- a/saleor/static/js/components/categoryPage/CategoryPage.js
+++ b/saleor/static/js/components/categoryPage/CategoryPage.js
@@ -111,7 +111,8 @@ class CategoryPage extends Component {
}
render() {
- const { attributes, category, relay: { variables } } = this.props;
+ const { attributes, category, relay: { variables }, relay } = this.props;
+ const { pendingVariables } = relay;
const { filtersMenu } = this.state;
return (
<div className="category-page">
@@ -174,6 +175,7 @@ class CategoryPage extends Component {
<ProductList
onLoadMore={this.incrementProductsCount}
products={category.products}
+ updating={pendingVariables}
/>
</div>
</div>
diff --git a/saleor/static/js/components/categoryPage/ProductList.js b/saleor/static/js/components/categoryPage/ProductList.js
index f66b334a16..fdf32d2d30 100644
--- a/saleor/static/js/components/categoryPage/ProductList.js
+++ b/saleor/static/js/components/categoryPage/ProductList.js
@@ -9,16 +9,17 @@ class ProductList extends Component {
static propTypes = {
onLoadMore: PropTypes.func.isRequired,
products: PropTypes.object,
- setSorting: PropTypes.object
+ setSorting: PropTypes.object,
+ updating: PropTypes.object
};
onLoadMore = () => this.props.onLoadMore();
setSorting = (event) => this.props.setSorting(event);
render() {
- const { edges, pageInfo: { hasNextPage } } = this.props.products;
+ const { edges, pageInfo: { hasNextPage } } = this.props.products;
return (
- <div>
+ <div className={this.props.updating && 'category-list--loading'}>
<div className="row">
{edges.length > 0 ? (edges.map((edge, i) => (
<ProductItem key={i} product={edge.node} />
diff --git a/saleor/static/scss/layouts/_category-page.scss b/saleor/static/scss/layouts/_category-page.scss
index 341a807311..f130b27930 100644
--- a/saleor/static/scss/layouts/_category-page.scss
+++ b/saleor/static/scss/layouts/_category-page.scss
@@ -8,6 +8,10 @@
}
.category-list {
margin-top: $global-margin;
+ &--loading {
+ opacity: 0.5;
+ transition: 0.3s;
+ }
}
.category-top {
border-bottom: solid 1px $gray;