Ignore:
Timestamp:
09/23/22 02:03:14 (2 years ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
895cd87
Parents:
436e0da
Message:

Implemented all use cases

Location:
phonelux-frontend/src/components/FiltersComponents
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • phonelux-frontend/src/components/FiltersComponents/FilterSelectComponent.js

    r436e0da r48f3030  
    1616      super(props)
    1717        const {type} = this.props
    18         console.log(type)
    1918      this.state = {
    2019         pickedItems: localStorage.getItem(type) ? localStorage.getItem(type).split(',') : [],
  • phonelux-frontend/src/components/FiltersComponents/SortByComponent.css

    r436e0da r48f3030  
    2020    overflow-y: scroll;
    2121}
     22
     23.pick-specifications-icon{
     24    margin-left: 10px;
     25}
     26
     27.pick-specifications-icon:hover{
     28    cursor: pointer;
     29}
     30
     31.specifications-filter-main{
     32    display: flex;
     33}
     34.tippy-pick-specifications-icon{
     35    width: fit-content;
     36    text-align: center;
     37}
  • phonelux-frontend/src/components/FiltersComponents/SortByComponent.js

    r436e0da r48f3030  
    33import './SortByComponent.css'
    44import SpecificationsFilterComponent from './SpecificationsFilterComponent'
     5import FilterAltIcon from '@mui/icons-material/FilterAlt';
     6import PickSpecificationComponent from '../PickSpecificationComponent/PickSpecificationComponent';
    57
    68export class SortByComponent extends Component {
     
    1012   
    1113      this.state = {
    12          sortBy: localStorage.getItem('sortBy') ? localStorage.getItem('sortBy') : 'mostPopular'
     14         sortBy: localStorage.getItem('sortBy') ? localStorage.getItem('sortBy') : 'mostPopular',
     15         openModal: false
    1316      }
    1417    }
  • phonelux-frontend/src/components/FiltersComponents/SpecificationsFilterComponent.css

    r436e0da r48f3030  
    1818.popover-specification-container{
    1919    overflow-y: scroll;
    20     height: 400px;
     20    height: fit-content;
     21    padding-bottom: 30px;
     22    max-height: 400px;
     23   
    2124}
    2225
  • phonelux-frontend/src/components/FiltersComponents/SpecificationsFilterComponent.js

    r436e0da r48f3030  
    88import FilterSelectComponent from './FilterSelectComponent';
    99import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
     10import PickSpecificationComponent from '../PickSpecificationComponent/PickSpecificationComponent';
     11import axios from 'axios';
     12import UserContext from '../../context/UserContext';
    1013export class SpecificationsFilterComponent extends Component {
    1114
     
    1417   
    1518      this.state = {
    16         anchorEl: null
     19        anchorEl: null,
     20        openModal: false,
    1721      }
    1822    }
     
    2933      })
    3034    };
     35
     36    handleModalClose = () =>{
     37      this.setState({
     38        openModal: false
     39      })
     40    }
     41
     42    handleModalOpen = () =>{
     43        this.setState({
     44            openModal: true
     45        })
     46    }
    3147
    3248  render() {
     
    5369        <div className='popover-specification-container'>
    5470        <h2 className='popover-specification-container-header'>Филтер за спецификации</h2>
    55         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='ram'></FilterSelectComponent>
    56         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='rom'></FilterSelectComponent>
    57         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='frontcamera'></FilterSelectComponent>
    58         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='backcamera'></FilterSelectComponent>
    59         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='chipset'></FilterSelectComponent>
    60         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='cpu'></FilterSelectComponent>
    61         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='operatingsystem'></FilterSelectComponent>
    62         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='color'></FilterSelectComponent>
    63         <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='battery'></FilterSelectComponent>
     71        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("РАМ меморија") ?
     72        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='ram'></FilterSelectComponent> : <></>
     73        }
     74        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("РОМ меморија") ?
     75        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='rom'></FilterSelectComponent> : <></>
     76        }
     77        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Предна камера") ?
     78        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='frontcamera'></FilterSelectComponent> : <></>
     79        }
     80        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Задна камера") ?
     81        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='backcamera'></FilterSelectComponent> : <></>
     82        }
     83        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Чипсет") ?
     84        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='chipset'></FilterSelectComponent> : <></>
     85        }
     86         { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Процесор") ?
     87        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='cpu'></FilterSelectComponent> : <></>
     88        }
     89        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Оперативен систем") ?
     90        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='operatingsystem'></FilterSelectComponent> : <></>
     91        }
     92        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Боја") ?
     93        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='color'></FilterSelectComponent> : <></>
     94        }
     95        { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Батерија") ?
     96        <FilterSelectComponent changeHandler={this.props.changeHandler} width={400} type='battery'></FilterSelectComponent> : <></>
     97        }
    6498        </div>
    6599      </Popover>
     100      <Tippy className='tippy-pick-specifications-icon' placement='bottom' content='Изберете спецификации за приказ'>
     101        <FilterAltIcon onClick={this.handleModalOpen} style={{fontSize: '35px'}} className='pick-specifications-icon'></FilterAltIcon>
     102        </Tippy>
     103        { this.context.userId != '' && <PickSpecificationComponent
     104        openModal={this.state.openModal}
     105        handleClose={this.handleModalClose}/> }
    66106      </div>
    67107    )
     
    69109}
    70110
     111SpecificationsFilterComponent.contextType = UserContext
     112
    71113export default SpecificationsFilterComponent
    72114
Note: See TracChangeset for help on using the changeset viewer.