Last change
on this file since 775e15e was e5b84dc, checked in by Marko <Marko@…>, 22 months ago |
Prototype version
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[dbd4834] | 1 | import React, { Component } from 'react'
|
---|
| 2 | import GroupedFiltersComponent from './GroupedFiltersComponent/GroupedFiltersComponent'
|
---|
| 3 | import HeaderComponent from './HeaderComponent/HeaderComponent'
|
---|
| 4 | import PhoneCardGridComponent from './PhoneCardGridComponent/PhoneCardGridComponent'
|
---|
| 5 |
|
---|
[e5b84dc] | 6 |
|
---|
[dbd4834] | 7 | export class HomepageComponent extends Component {
|
---|
| 8 |
|
---|
| 9 | constructor(props) {
|
---|
| 10 | super(props)
|
---|
| 11 |
|
---|
| 12 | this.state = {
|
---|
[e5b84dc] | 13 | shops: '',
|
---|
| 14 | brands: '',
|
---|
| 15 | priceRange: '',
|
---|
| 16 | searchValue: '',
|
---|
| 17 | sortBy: 'mostPopular'
|
---|
[dbd4834] | 18 | }
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | changeFilters = (e) => {
|
---|
| 22 |
|
---|
| 23 | if(e.hasOwnProperty('priceRange'))
|
---|
| 24 | {
|
---|
| 25 | this.setState({
|
---|
| 26 | priceRange: e.priceRange
|
---|
| 27 | })
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | if(e.hasOwnProperty('shops'))
|
---|
| 31 | {
|
---|
| 32 | this.setState({
|
---|
| 33 | shops: e.shops
|
---|
| 34 | })
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | if(e.hasOwnProperty('brands'))
|
---|
| 38 | {
|
---|
| 39 | this.setState({
|
---|
| 40 | brands: e.brands
|
---|
| 41 | })
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | if(e.hasOwnProperty('searchValue'))
|
---|
| 45 | {
|
---|
| 46 | this.setState({
|
---|
| 47 | searchValue: e.searchValue
|
---|
| 48 | })
|
---|
[e5b84dc] | 49 |
|
---|
[dbd4834] | 50 | }
|
---|
| 51 |
|
---|
| 52 | if(e.hasOwnProperty('sortBy'))
|
---|
| 53 | {
|
---|
| 54 | this.setState({
|
---|
| 55 | sortBy: e.sortBy
|
---|
| 56 | })
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[e5b84dc] | 60 |
|
---|
[dbd4834] | 61 | render() {
|
---|
| 62 | return (
|
---|
| 63 | <>
|
---|
| 64 | <HeaderComponent/>
|
---|
| 65 | <GroupedFiltersComponent passFilters={this.changeFilters}/>
|
---|
[e5b84dc] | 66 | <PhoneCardGridComponent {...this.state}/>
|
---|
[dbd4834] | 67 | </>
|
---|
| 68 | )
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | export default HomepageComponent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.