-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
persist store added. directory and shop state goes to redux. Changed …
…routing in shop page
- Loading branch information
Karthick-Ramanathan
committed
Jul 26, 2020
1 parent
1039ed4
commit 28cc81a
Showing
20 changed files
with
548 additions
and
324 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.collection-item { | ||
width: 22%; | ||
width: 22vw; | ||
display: flex; | ||
flex-direction: column; | ||
height: 350px; | ||
|
4 changes: 4 additions & 0 deletions
4
src/components/collections-overview/collection-overview.styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.collection-overview { | ||
display: flex; | ||
flex-direction: column; | ||
} |
30 changes: 30 additions & 0 deletions
30
src/components/collections-overview/collection-overview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import { useSelector } from 'react-redux' | ||
|
||
import './collection-overview.styles.scss' | ||
|
||
import CollectionPreview from '../collection-preview/collection-preview' | ||
import { selectShopCollectionsForPreview } from '../../redux/shop-selector' | ||
|
||
type CollectionOverviewProps = {} | ||
|
||
const CollectionOverview = (props: CollectionOverviewProps) => { | ||
|
||
const collections = useSelector(selectShopCollectionsForPreview) | ||
|
||
return ( | ||
<div className='collection-overview'> | ||
{ | ||
collections.map((collection) => ( | ||
<CollectionPreview | ||
key={collection.id} | ||
title={collection.title} | ||
items={collection.items} | ||
/> | ||
)) | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
export default CollectionOverview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import {BrowserRouter} from 'react-router-dom' | ||
import {Provider} from 'react-redux' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { BrowserRouter } from 'react-router-dom' | ||
import { Provider } from 'react-redux' | ||
import { PersistGate } from 'redux-persist/integration/react' | ||
|
||
import './index.css'; | ||
import App from './App'; | ||
import store from './redux/store' | ||
import './index.css' | ||
import App from './App' | ||
import { store, persistor } from './redux/store' | ||
|
||
ReactDOM.render( | ||
<Provider store={store}> | ||
<BrowserRouter> | ||
<App /> | ||
<PersistGate persistor={persistor}> | ||
<App /> | ||
</PersistGate> | ||
</BrowserRouter> | ||
</Provider> | ||
, document.getElementById('root')); | ||
, document.getElementById('root')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.collection-page { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
.title { | ||
font-size: 38px; | ||
margin: 0 auto 30px; | ||
} | ||
|
||
.items { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr 1fr; | ||
grid-gap: 10px; | ||
|
||
& .collection-item { | ||
margin-bottom: 30px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import { RouteComponentProps } from 'react-router-dom' | ||
import { useSelector } from 'react-redux' | ||
import { selectCollection } from '../../redux/shop-selector' | ||
|
||
import './collection-page.styles.scss' | ||
|
||
import CollectionItem from '../../components/collection-item/collection-item' | ||
|
||
type MatchParams = { | ||
collectionId: string | ||
} | ||
|
||
const CollectionPage = ({ match }: RouteComponentProps<MatchParams>) => { | ||
|
||
const collection = useSelector(selectCollection(match.params.collectionId)) | ||
|
||
return ( | ||
<div className='collection-page'> | ||
<h2 className='title'>{collection?.title}</h2> | ||
<div className='items'> | ||
{ | ||
collection?.items.map(item => (<CollectionItem key={item.id} product={item} />)) | ||
} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CollectionPage |
Oops, something went wrong.