source: phonelux-frontend/src/components/HomepageComponent.js@ dbd4834

Last change on this file since dbd4834 was dbd4834, checked in by Marko <Marko@…>, 2 years ago

Homepage, login and register components added

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import React, { Component } from 'react'
2import GroupedFiltersComponent from './GroupedFiltersComponent/GroupedFiltersComponent'
3import HeaderComponent from './HeaderComponent/HeaderComponent'
4import PhoneCardGridComponent from './PhoneCardGridComponent/PhoneCardGridComponent'
5
6export class HomepageComponent extends Component {
7
8constructor(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
20changeFilters = (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
69export default HomepageComponent
Note: See TracBrowser for help on using the repository browser.