File tree Expand file tree Collapse file tree 5 files changed +22
-29
lines changed
components/collection-item Expand file tree Collapse file tree 5 files changed +22
-29
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,15 @@ import CollectionItem from '../../components/collection-item/collection-item.com
55import './collection.styles.scss'
66
77function CollectionPage ( { match, collection } ) {
8- console . log ( collection )
8+ const { title , items } = collection
99 return (
10- < div className = "collectionPage" >
11- < h2 > CategoryPage</ h2 >
10+ < div className = "collection-page" >
11+ < h2 className = "title" > { title } </ h2 >
12+ < div className = "items" >
13+ {
14+ items . map ( item => < CollectionItem key = { item . id } item = { item } /> )
15+ }
16+ </ div >
1217 </ div >
1318 )
1419}
Original file line number Diff line number Diff line change 11.collection-item {
2- width : 22 % ;
2+ width : 22 vw ;
33 display : flex ;
44 flex-direction : column ;
55 height : 350px ;
Original file line number Diff line number Diff line change @@ -3,38 +3,33 @@ const INITIAL_STATE = {
33 title : 'hats' ,
44 imageUrl : 'https://i.ibb.co/cvpntL1/hats.png' ,
55 id : 1 ,
6- linkUrl : 'hats'
7- // linkUrl: 'shop/hats'
6+ linkUrl : 'shop/hats'
87 } ,
98 {
109 title : 'jackets' ,
1110 imageUrl : 'https://i.ibb.co/px2tCc3/jackets.png' ,
1211 id : 2 ,
13- linkUrl : 'jackets'
14- // linkUrl: 'shop/jackets'
12+ linkUrl : 'shop/jackets'
1513 } ,
1614 {
1715 title : 'sneakers' ,
1816 imageUrl : 'https://i.ibb.co/0jqHpnp/sneakers.png' ,
1917 id : 3 ,
20- linkUrl : 'sneakers'
21- // linkUrl: 'shop/sneakers'
18+ linkUrl : 'shop/sneakers'
2219 } ,
2320 {
2421 title : 'womens' ,
2522 imageUrl : 'https://i.ibb.co/GCCdy8t/womens.png' ,
2623 size : 'large' ,
2724 id : 4 ,
28- linkUrl : 'womens'
29- // linkUrl: 'shop/womens'
25+ linkUrl : 'shop/womens'
3026 } ,
3127 {
3228 title : ' mens ' ,
3329 imageUrl : 'https://i.ibb.co/R70vBrQ/men.png' ,
3430 size : 'large' ,
3531 id : 5 ,
36- linkUrl : 'mens'
37- // linkUrl: 'shop/mens'
32+ linkUrl : 'shop/mens'
3833 } ]
3934}
4035
Original file line number Diff line number Diff line change 1- const SHOP_DATA = [
2- {
1+ const SHOP_DATA = {
2+ hats : {
33 id : 1 ,
44 title : 'Hats' ,
55 routeName : 'hats' ,
@@ -60,7 +60,7 @@ const SHOP_DATA = [
6060 }
6161 ]
6262 } ,
63- {
63+ sneakers : {
6464 id : 2 ,
6565 title : 'Sneakers' ,
6666 routeName : 'sneakers' ,
@@ -115,7 +115,7 @@ const SHOP_DATA = [
115115 }
116116 ]
117117 } ,
118- {
118+ jackets : {
119119 id : 3 ,
120120 title : 'Jackets' ,
121121 routeName : 'jackets' ,
@@ -152,7 +152,7 @@ const SHOP_DATA = [
152152 }
153153 ]
154154 } ,
155- {
155+ womens : {
156156 id : 4 ,
157157 title : 'Womens' ,
158158 routeName : 'womens' ,
@@ -201,7 +201,7 @@ const SHOP_DATA = [
201201 }
202202 ]
203203 } ,
204- {
204+ mens : {
205205 id : 5 ,
206206 title : 'Mens' ,
207207 routeName : 'mens' ,
@@ -244,6 +244,6 @@ const SHOP_DATA = [
244244 }
245245 ]
246246 }
247- ] ;
247+ } ;
248248
249249export default SHOP_DATA ;
Original file line number Diff line number Diff line change @@ -2,13 +2,6 @@ import { createSelector } from "reselect";
22
33const selectShop = state => state . shop
44
5- const COLLECTION_ID_MAP = {
6- hats : 1 ,
7- sneakers : 2 ,
8- jackets : 3 ,
9- womens : 4 ,
10- mens : 5
11- }
125export const selectCollections = createSelector (
136 [ selectShop ] ,
147 shop => shop . collections
@@ -17,5 +10,5 @@ export const selectCollections = createSelector(
1710export const selectCollection = collectionUrlParam =>
1811 createSelector (
1912 [ selectCollections ] ,
20- collections => collections . find ( collection => collection . id === COLLECTION_ID_MAP [ collectionUrlParam ] )
13+ collections => collections [ collectionUrlParam ]
2114 )
You can’t perform that action at this time.
0 commit comments