Last change
on this file since f25d07e was dbd4834, checked in by Marko <Marko@…>, 22 months ago |
Homepage, login and register components added
|
-
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 |
|
---|
| 6 | export class HomepageComponent extends Component {
|
---|
| 7 |
|
---|
| 8 | constructor(props) {
|
---|
| 9 | super(props)
|
---|
| 10 |
|
---|
| 11 | this.state = {
|
---|
| 12 | shops: null,
|
---|
| 13 | brands: null,
|
---|
| 14 | priceRange: null,
|
---|
| 15 | searchValue: null,
|
---|
| 16 | sortBy: null
|
---|
| 17 | }
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | changeFilters = (e) => {
|
---|
| 21 |
|
---|
| 22 | if(e.hasOwnProperty('priceRange'))
|
---|
| 23 | {
|
---|
| 24 | this.setState({
|
---|
| 25 | priceRange: e.priceRange
|
---|
| 26 | })
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | if(e.hasOwnProperty('shops'))
|
---|
| 30 | {
|
---|
| 31 | this.setState({
|
---|
| 32 | shops: e.shops
|
---|
| 33 | })
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | if(e.hasOwnProperty('brands'))
|
---|
| 37 | {
|
---|
| 38 | this.setState({
|
---|
| 39 | brands: e.brands
|
---|
| 40 | })
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | if(e.hasOwnProperty('searchValue'))
|
---|
| 44 | {
|
---|
| 45 | this.setState({
|
---|
| 46 | searchValue: e.searchValue
|
---|
| 47 | })
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | if(e.hasOwnProperty('sortBy'))
|
---|
| 51 | {
|
---|
| 52 | this.setState({
|
---|
| 53 | sortBy: e.sortBy
|
---|
| 54 | })
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | render() {
|
---|
| 59 | return (
|
---|
| 60 | <>
|
---|
| 61 | <HeaderComponent/>
|
---|
| 62 | <GroupedFiltersComponent passFilters={this.changeFilters}/>
|
---|
| 63 | <PhoneCardGridComponent/>
|
---|
| 64 | </>
|
---|
| 65 | )
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | export default HomepageComponent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.