-
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.
- Loading branch information
1 parent
74b3825
commit 8621432
Showing
8 changed files
with
372 additions
and
8 deletions.
There are no files selected for viewing
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,22 +1,20 @@ | ||
import React from 'react'; | ||
import { Switch, Route } from 'react-router-dom'; | ||
|
||
import './App.css'; | ||
|
||
import HomePage from './pages/homepage/homepage.component'; | ||
const HatsPage = () => ( | ||
<div> | ||
<h1>HATS PAGE - fake, const </h1> | ||
</div> | ||
); | ||
import ShopPage from "./pages/shop/shop.component"; | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<Switch> | ||
<Route exact path='/' component={HomePage} /> | ||
<Route path='/shop/hats' component={HatsPage} /> | ||
<Route path='/shop' component={ShopPage} /> | ||
</Switch> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
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,20 @@ | ||
import React from "react"; | ||
import './collection-item.styles.scss' | ||
|
||
const CollectionItem = ({id, name, imageUrl, price}) => ( | ||
<div className='collection-item'> | ||
<div | ||
className='image' | ||
style={{ | ||
backgroundImage: `url(${imageUrl})` | ||
}} | ||
> | ||
</div> | ||
<div className='collection-footer'> | ||
<span className='name'>{ name } </span> | ||
<span className='price'>{ price } </span> | ||
</div> | ||
</div> | ||
) | ||
|
||
export default CollectionItem; |
32 changes: 32 additions & 0 deletions
32
src/components/collection-item/collection-item.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,32 @@ | ||
.collection-item { | ||
width: 22%; | ||
display: flex; | ||
flex-direction: column; | ||
height: 350px; | ||
align-items: center; | ||
|
||
.image { | ||
width: 100%; | ||
height: 95%; | ||
background-size: cover; | ||
background-position: center; | ||
margin-bottom: 5px; | ||
} | ||
|
||
.collection-footer { | ||
width: 100%; | ||
height: 5%; | ||
display: flex; | ||
justify-content: space-between; | ||
font-size: 18px; | ||
|
||
.name { | ||
width: 90%; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.price { | ||
width: 10%; | ||
} | ||
} | ||
} |
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,20 @@ | ||
import React from "react"; | ||
|
||
import CollectionItem from "../collection-item/collection-item"; | ||
|
||
import './collection-preview.styles.scss' | ||
|
||
const CollectionPreview = ({title, items}) => ( | ||
<div className='collection-preview'> | ||
<h1 className='title'> {title.toUpperCase()}</h1> | ||
<div className='preview'> | ||
{items | ||
.filter((item, idx) => idx < 4) | ||
.map(({id, ...otherItemProps}) => ( | ||
<CollectionItem key={id} {...otherItemProps}/> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
|
||
export default CollectionPreview; |
15 changes: 15 additions & 0 deletions
15
src/components/collection-preview/collection-preview.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,15 @@ | ||
.collection-preview { | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 30px; | ||
|
||
.title { | ||
font-size: 28px; | ||
margin-bottom: 25px; | ||
} | ||
|
||
.preview { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from "react"; | ||
|
||
import SHOP_DATA from "./shop.data"; | ||
|
||
import CollectionPreview from "../../components/collection-preview/collection-preview"; | ||
|
||
class ShopPage extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
collections: SHOP_DATA | ||
}; | ||
} | ||
|
||
render() { | ||
const {collections} = this.state; | ||
return (<div className='shop-page'> | ||
{ | ||
collections.map(({id, ...otherCollectionProps}) => ( | ||
<CollectionPreview key={id} {...otherCollectionProps} /> | ||
))} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ShopPage; |
Oops, something went wrong.