Skip to content

Commit 0225de8

Browse files
committed
number and int should handle same
1 parent d1c30cd commit 0225de8

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

src/components/Filter/Filter.jsx

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const Filter = () => {
8989
)) {
9090
const constraint =
9191
_selectedProductData.constraints.properties[constraintName]
92-
if (constraint.type === 'integer') {
92+
if (constraint.type === 'integer' || constraint.type === 'number') {
9393
filterContainer.push(
9494
<FormControl key={constraintName} sx={{ marginTop: 4 }}>
9595
<FormControlLabel
@@ -127,57 +127,6 @@ const Filter = () => {
127127
continue
128128
}
129129

130-
if (constraint.type === 'number') {
131-
filterContainer.push(
132-
<FormControl key={constraintName} sx={{ marginTop: 4 }}>
133-
<InputLabel
134-
htmlFor={constraintName}
135-
sx={{ color: '#FFF', paddingTop: 2 }}
136-
>
137-
{constraint.title}
138-
</InputLabel>
139-
<FormControlLabel
140-
control={
141-
<Switch
142-
id={constraintName}
143-
name={constraintName}
144-
aria-describedby={constraintName}
145-
checked={
146-
_selectedProductFilters[constraintName] || constraint.default
147-
}
148-
onChange={(event) => {
149-
store.dispatch(
150-
setSelectedProductFilters({
151-
..._selectedProductFilters,
152-
[constraintName]: event.target.checked
153-
})
154-
)
155-
}}
156-
/>
157-
}
158-
label={constraint.title}
159-
labelPlacement="top"
160-
/>
161-
<Slider
162-
id={constraintName}
163-
name={constraintName}
164-
valueLabelDisplay="on"
165-
min={constraint.minimum}
166-
max={constraint.maximum}
167-
value={_selectedProductFilters[constraintName] || [0, 0]} // TODO: this should be managed by redux, but it's not working right now :) (the other controls should also be added on redux)
168-
onChange={(event, newValue) => {
169-
store.dispatch(
170-
setSelectedProductFilters({
171-
..._selectedProductFilters,
172-
[constraintName]: newValue
173-
})
174-
)
175-
}}
176-
/>
177-
</FormControl>
178-
)
179-
continue
180-
}
181130
if (constraint.type === 'string') {
182131
filterContainer.push(
183132
<FormControl key={constraintName}>

0 commit comments

Comments
 (0)