Changeset d66b8eb for phonelux-frontend/src/components/PhoneOfferComponent
- Timestamp:
- 09/21/22 18:47:39 (2 years ago)
- Branches:
- master
- Children:
- 34950c6
- Parents:
- 5201690
- Location:
- phonelux-frontend/src/components/PhoneOfferComponent
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
phonelux-frontend/src/components/PhoneOfferComponent/PhoneOfferComponent.css
r5201690 rd66b8eb 35 35 cursor: pointer; 36 36 } 37 38 .phone-offer-compare-icon:hover{ 39 cursor: pointer; 40 } 41 42 .phone-offer-remove-favouriteoffer-icon:hover{ 43 cursor: pointer; 44 } 45 46 .phone-offer-remove-favouriteoffer-icon{ 47 color: rgb(226, 213, 39); 48 } 49 50 .phone-offer-compare-selected-icon:hover{ 51 cursor: pointer; 52 } 53 54 .phone-offer-compare-selected-icon{ 55 color: rgb(226, 213, 39); 56 } 57 58 59 60 -
phonelux-frontend/src/components/PhoneOfferComponent/PhoneOfferComponent.js
r5201690 rd66b8eb 9 9 import VisibilityIcon from '@mui/icons-material/Visibility'; 10 10 import CheckIcon from '@mui/icons-material/Check'; 11 import CompareIcon from '@mui/icons-material/Compare'; 12 import BookmarkRemoveIcon from '@mui/icons-material/BookmarkRemove'; 11 13 12 14 export class PhoneOfferComponent extends Component { … … 16 18 17 19 this.state = { 18 19 20 } 20 21 } … … 72 73 }); 73 74 } 75 76 handleOfferCompare = () => { 77 let offersToCompare = [] 78 if(localStorage.getItem('offersToCompare')) 79 { 80 offersToCompare = JSON.parse(localStorage.getItem('offersToCompare')) 81 } 82 83 if(!offersToCompare.includes(this.props.id) && offersToCompare.length<5) 84 { 85 offersToCompare.push(this.props.id) 86 } 87 else{ 88 offersToCompare = offersToCompare.filter(offer => offer != this.props.id) 89 } 90 localStorage.setItem('offersToCompare', JSON.stringify(offersToCompare)) 91 this.forceUpdate() 92 } 74 93 75 94 … … 81 100 <td>{this.props.price} ден.</td> 82 101 <td> 102 103 {/* if else jsx syntax here to add icon */} 104 105 {(() => { 106 if(!localStorage.getItem('token')) 107 { 108 return <></> 109 } 110 111 if(localStorage.getItem('offersToCompare') && localStorage.getItem('offersToCompare').includes(this.props.id)) 112 { 113 return <Tippy placement='bottom' content='Избриши понуда за споредба'> 114 <CompareIcon onClick={this.handleOfferCompare} className='phone-offer-compare-selected-icon' style={{fontSize: '40px', marginRight: '10px' }}/> 115 </Tippy> 116 } 117 else{ 118 return <Tippy placement='bottom' content='Додади понуда за споредба'> 119 <CompareIcon onClick={this.handleOfferCompare} className='phone-offer-compare-icon' style={{fontSize: '40px', marginRight: '10px' }}/> 120 </Tippy> 121 } 122 })()} 123 {/* { 124 localStorage.getItem('token') && !localStorage.getItem('offersToCompare').includes(this.props.id)? 125 <Tippy placement='bottom' content='Додади понуда за споредба'> 126 <CompareIcon onClick={this.handleOfferCompare} className='phone-offer-compare-icon' style={{fontSize: '40px', marginRight: '10px' }}/> 127 </Tippy> : <></> 128 } */} 83 129 { 84 130 window.location.href.split('/')[5] == 'favouriteoffers' ? … … 98 144 localStorage.getItem('token') && this.props.loggedUserFavouriteOffers.filter(offer => offer.id == this.props.id).length != 0? 99 145 <Tippy placement='bottom' content='Избриши од омилени понуди'> 100 <StarIcon onClick={this.removeFromFavourite} className='phone-offer- favouriteoffer-icon' style={{fontSize: '40px', marginRight: '10px' }}/>146 <StarIcon onClick={this.removeFromFavourite} className='phone-offer-remove-favouriteoffer-icon' style={{fontSize: '40px', marginRight: '10px' }}/> 101 147 </Tippy> 102 148 : <></> … … 105 151 106 152 <Link style={{ textDecoration: 'none' }} to={"/phoneoffer/"+this.props.id}> 107 <button className='phone-offer-specifications-button'> Спецификации</button>153 <button className='phone-offer-specifications-button'><b>Спецификации</b></button> 108 154 </Link> 109 155 </td>
Note:
See TracChangeset
for help on using the changeset viewer.