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