Skip to content

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

Change filters button to checkbox

Krzysztof Białogłowicz137507f826e2
diff --git a/saleor/static/js/components/ProductFilters.js b/saleor/static/js/components/ProductFilters.js
index a5aae9b066..51253fd1b8 100644
--- a/saleor/static/js/components/ProductFilters.js
+++ b/saleor/static/js/components/ProductFilters.js
@@ -44,12 +44,6 @@ class ProductFilters extends Component {
}
history.pushState({}, null , url);
-
- if (element.classList.contains('active')) {
- element.classList.remove('active');
- } else {
- element.classList.add('active');
- }
}
componentDidMount() {
@@ -65,7 +59,7 @@ class ProductFilters extends Component {
{[attrValue]: true})
});
const elementID = 'attr'+params+param;
- document.getElementById(elementID).classList.add('active');
+ document.getElementById(elementID).checked = true;
})
} else {
attrValue = `${params}:${url_params[params]}`;
@@ -75,7 +69,7 @@ class ProductFilters extends Component {
{[attrValue]: true})
});
const elementID = 'attr'+params+url_params[params];
- document.getElementById(elementID).classList.add('active');
+ document.getElementById(elementID).checked = true;
}
})
@@ -93,19 +87,13 @@ class ProductFilters extends Component {
<ul className={attribute.name}>
<h3>{attribute.display}</h3>
{attribute.values.map((value) => {
- const colorStyle = {
- backgroundColor: value.color
- }
return (
- <button
- id={'attr' + attribute.pk+value.pk}
- key={value.id}
- className="item"
- style={colorStyle}
- onClick={(event) => this.onClick(attribute.pk, value.pk, event)}
- >
- {value.display}
- </button>
+ <li key={value.id}>
+ <label >
+ <input id={"attr"+attribute.pk+value.pk} type="checkbox" value="" onClick={(event) => this.onClick(attribute.pk, value.pk, event)} />
+ {value.display}
+ </label>
+ </li>
)
})}
</ul>
diff --git a/saleor/static/scss/demo/components/_category-page.scss b/saleor/static/scss/demo/components/_category-page.scss
index 48c1b03f52..c55249fa54 100644
--- a/saleor/static/scss/demo/components/_category-page.scss
+++ b/saleor/static/scss/demo/components/_category-page.scss
@@ -4,18 +4,11 @@
}
ul {
padding: $global-padding/2 0;
- }
- .item {
- min-width: 4rem;
- background: $white;
- border-radius: 1rem;
- border: solid 1px $gray;
- padding: $global-padding/2;
- margin: 0 $global-margin/2;
- outline: 0;
- cursor: pointer;
- &.active {
- background: $gray;
+ list-style: none;
+ li {
+ input {
+ margin-right: $global-margin;
+ }
}
}
.price-range {