Skip to content

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

Fix category-page on mobile

Krzysztof Białogłowiczf50025ec2cd1
diff --git a/saleor/static/js/components/categoryPage/CategoryPage.js b/saleor/static/js/components/categoryPage/CategoryPage.js
index e480db1ca4..a9ffc22cf4 100644
--- a/saleor/static/js/components/categoryPage/CategoryPage.js
+++ b/saleor/static/js/components/categoryPage/CategoryPage.js
@@ -111,7 +111,7 @@ class CategoryPage extends Component {
</div>
</div>
<div className="row">
- <div className="col-md-3">
+ <div className="col-md-4 col-lg-3">
<div className="product-filters">
<CategoryFilter category={category} />
</div>
@@ -129,7 +129,7 @@ class CategoryPage extends Component {
/>
</div>
</div>
- <div className="col-md-9 category-list">
+ <div className="col-md-8 col-lg-9 category-list">
<div>
<ProductList
onLoadMore={this.incrementProductsCount}
diff --git a/saleor/static/js/components/categoryPage/PriceFilter.js b/saleor/static/js/components/categoryPage/PriceFilter.js
index 94d132b5fb..253ab37c67 100644
--- a/saleor/static/js/components/categoryPage/PriceFilter.js
+++ b/saleor/static/js/components/categoryPage/PriceFilter.js
@@ -5,9 +5,15 @@ export default class PriceFilter extends Component {
constructor(props) {
super(props);
- this.state = {
- visibility: true
- };
+ if (window.innerWidth <= 700) {
+ this.state = {
+ visibility: false
+ };
+ } else {
+ this.state = {
+ visibility: true
+ };
+ }
}
static propTypes = {
@@ -68,7 +74,7 @@ export default class PriceFilter extends Component {
ref={input => (this.maxPriceInput = input)}
type="number"
/>
- <button className="btn" onClick={this.updateFilter}>{gettext('Update')}</button>
+ <button className="btn btn-primary" onClick={this.updateFilter}>{gettext('Update')}</button>
</div>
)}
</div>
diff --git a/saleor/static/js/components/categoryPage/ProductFilters.js b/saleor/static/js/components/categoryPage/ProductFilters.js
index d6d17e909a..a5b2dea922 100644
--- a/saleor/static/js/components/categoryPage/ProductFilters.js
+++ b/saleor/static/js/components/categoryPage/ProductFilters.js
@@ -36,9 +36,16 @@ class ProductFilters extends Component {
componentWillMount() {
this.props.attributes.map((attribute) => {
const attrValue = `${attribute.name}`;
- this.setState({
- visibility: Object.assign(this.state.visibility, {[attrValue]: true})
- });
+ console.log(window.innerWidth);
+ if (window.innerWidth <= 700) {
+ this.setState({
+ visibility: Object.assign(this.state.visibility, {[attrValue]: false})
+ });
+ } else {
+ this.setState({
+ visibility: Object.assign(this.state.visibility, {[attrValue]: true})
+ });
+ }
});
}