forked from css-for-js/sole-and-ankle
-
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
9e49b70
commit 8e88da6
Showing
19 changed files
with
207 additions
and
20 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,59 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const ShoeCard = ({ | ||
slug, | ||
name, | ||
imageSrc, | ||
price, | ||
salePrice, | ||
releaseDate, | ||
numOfColors, | ||
}) => { | ||
// There are 3 variants possible, based on the props: | ||
// - new-release | ||
// - on-sale | ||
// - default | ||
// | ||
// Any shoe released in the last month will be considered | ||
// `new-release`. Any shoe with a `salePrice` will be | ||
// on-sale. In theory, it is possible for a shoe to be | ||
// both on-sale and new-release, but in this case, `on-sale` | ||
// will triumph and be the variant used. | ||
|
||
return ( | ||
<Wrapper> | ||
<ImageWrapper> | ||
<Image alt="" src={imageSrc} /> | ||
<ImageSizer /> | ||
</ImageWrapper> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.article` | ||
flex: 1; | ||
min-width: 325px; | ||
max-width: 550px; | ||
`; | ||
|
||
const ImageWrapper = styled.div` | ||
position: relative; | ||
`; | ||
|
||
const Image = styled.img` | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
`; | ||
|
||
const ImageSizer = styled.div` | ||
width: 100%; | ||
height: 0; | ||
padding-bottom: 90%; | ||
`; | ||
|
||
export default ShoeCard; |
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 @@ | ||
export { default } from './ShoeCard'; |
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,23 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import SHOES from '../../data'; | ||
import ShoeCard from '../ShoeCard'; | ||
|
||
const ShoeGrid = () => { | ||
return ( | ||
<Wrapper> | ||
{SHOES.map((shoe) => ( | ||
<ShoeCard key={shoe.slug} {...shoe} /> | ||
))} | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
gap: 36px; | ||
flex-wrap: wrap; | ||
`; | ||
|
||
export default ShoeGrid; |
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 @@ | ||
export { default } from './ShoeGrid'; |
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,97 @@ | ||
/** | ||
* In a real app, this data would likely live in a database, | ||
* and be fetched from an API, either at runtime or at | ||
* compile-time. | ||
* | ||
* Keep in mind, this workshop is focused on CSS. In order | ||
* to make it easy to focus on the styling, we're cutting | ||
* some corners when it comes to our data management, and | ||
* our JavaScript in general. Please don't try to glean | ||
* any best-practices from stuff like this data file! | ||
*/ | ||
|
||
const SHOES = [ | ||
{ | ||
slug: 'tech-challenge', | ||
name: 'NikeCourt Tech Challenge 20', | ||
imageSrc: '/assets/tech-challenge.jpg', | ||
price: 16500, | ||
salePrice: null, | ||
releaseDate: '2021-03-01T09:30:00-0400', | ||
numOfColors: 2, | ||
}, | ||
{ | ||
slug: 'metcon-5', | ||
name: 'Nike Metcon 5 AMP', | ||
imageSrc: '/assets/metcon-5.jpg', | ||
price: 16500, | ||
salePrice: null, | ||
releaseDate: '2021-02-27T09:30:00-0400', | ||
numOfColors: 1, | ||
}, | ||
{ | ||
slug: 'phantom', | ||
name: 'Nike Phantom Vision Elite Dynamic Fit FG', | ||
imageSrc: '/assets/phantom.jpg', | ||
price: 16500, | ||
salePrice: null, | ||
releaseDate: '2021-02-21T09:30:00-0400', | ||
numOfColors: 4, | ||
}, | ||
{ | ||
slug: 'pegasus', | ||
name: 'Nike Air Zoom Pegasus 36 Trail', | ||
imageSrc: '/assets/pegasus.jpg', | ||
price: 16500, | ||
salePrice: null, | ||
releaseDate: '2021-02-16T09:30:00-0400', | ||
numOfColors: 1, | ||
}, | ||
{ | ||
slug: 'joyride', | ||
name: 'Nike Joyride Dual Run', | ||
imageSrc: '/assets/joyride.jpg', | ||
price: 17000, | ||
salePrice: null, | ||
releaseDate: '2021-01-30T09:30:00-0400', | ||
numOfColors: 2, | ||
}, | ||
{ | ||
slug: 'legend-academy', | ||
name: 'Nike Tiempo Legend 8 Academy TF', | ||
imageSrc: '/assets/legend-academy.jpg', | ||
price: 16500, | ||
salePrice: 12500, | ||
releaseDate: '2021-01-24T09:30:00-0400', | ||
numOfColors: 8, | ||
}, | ||
{ | ||
slug: 'react-infinity', | ||
name: 'Nike React Infinity Pro', | ||
imageSrc: '/assets/react-infinity.jpg', | ||
price: 16000, | ||
salePrice: 14500, | ||
releaseDate: '2021-01-14T09:30:00-0400', | ||
numOfColors: 1, | ||
}, | ||
{ | ||
slug: 'phantom-flyknit', | ||
name: 'Nike React Phantom Run Flyknit 2', | ||
imageSrc: '/assets/phantom-flyknit.jpg', | ||
price: 18500, | ||
salePrice: 16000, | ||
releaseDate: '2021-01-02T09:30:00-0400', | ||
numOfColors: 4, | ||
}, | ||
{ | ||
slug: 'lebron', | ||
name: 'LeBron 17', | ||
imageSrc: '/assets/lebron.jpg', | ||
price: 26000, | ||
salePrice: null, | ||
releaseDate: '2020-12-25T09:30:00-0400', | ||
numOfColors: 1, | ||
}, | ||
]; | ||
|
||
export default SHOES; |