Last change
on this file since 895cd87 was 48f3030, checked in by Marko <Marko@…>, 22 months ago |
Implemented all use cases
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import React, { Component } from 'react'
|
---|
2 | import { Link } from 'react-router-dom'
|
---|
3 | import './SortByComponent.css'
|
---|
4 | import SpecificationsFilterComponent from './SpecificationsFilterComponent'
|
---|
5 | import FilterAltIcon from '@mui/icons-material/FilterAlt';
|
---|
6 | import PickSpecificationComponent from '../PickSpecificationComponent/PickSpecificationComponent';
|
---|
7 |
|
---|
8 | export class SortByComponent extends Component {
|
---|
9 |
|
---|
10 | constructor(props) {
|
---|
11 | super(props)
|
---|
12 |
|
---|
13 | this.state = {
|
---|
14 | sortBy: localStorage.getItem('sortBy') ? localStorage.getItem('sortBy') : 'mostPopular',
|
---|
15 | openModal: false
|
---|
16 | }
|
---|
17 | }
|
---|
18 |
|
---|
19 | handleChange = (e) => {
|
---|
20 | this.props.changeHandler({sortBy: e.target.value})
|
---|
21 | localStorage.setItem('sortBy',e.target.value)
|
---|
22 | }
|
---|
23 |
|
---|
24 | render() {
|
---|
25 | return (
|
---|
26 | <div className="sortby-component-wrapper">
|
---|
27 | {localStorage.getItem('token') ? <SpecificationsFilterComponent changeHandler={this.props.changeHandler}/> : <></>}
|
---|
28 | <select defaultValue={this.state.sortBy} onChange={this.handleChange} className='sortby-component-select'>
|
---|
29 | <option value="mostPopular">Најпопуларно</option>
|
---|
30 | <option value="ascending">Цена: Ниска {'>'} Висока</option>
|
---|
31 | <option value="descending">Цена: Висока {'>'} Ниска</option>
|
---|
32 | </select>
|
---|
33 | </div>
|
---|
34 | )
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | export default SortByComponent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.