[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise 4b #6

Closed
16 changes: 9 additions & 7 deletions src/components/ShoeCard/ShoeCard.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import styled from 'styled-components/macro';
import React from "react";
import styled from "styled-components/macro";

import { COLORS, WEIGHTS } from '../../constants';
import { formatPrice, pluralize, isNewShoe } from '../../utils';
import Spacer from '../Spacer';
import { COLORS, WEIGHTS } from "../../constants";
import { formatPrice, pluralize, isNewShoe } from "../../utils";
import Spacer from "../Spacer";

const ShoeCard = ({
slug,
Expand Down Expand Up @@ -43,7 +43,7 @@ const ShoeCard = ({
<Price>{formatPrice(price)}</Price>
</Row>
<Row>
<ColorInfo>{pluralize('Color', numOfColors)}</ColorInfo>
<ColorInfo>{pluralize("Color", numOfColors)}</ColorInfo>
</Row>
</Wrapper>
</Link>
Expand All @@ -61,7 +61,9 @@ const ImageWrapper = styled.div`
position: relative;
`;

const Image = styled.img``;
const Image = styled.img`
width: 100%;
`;

const Row = styled.div`
font-size: 1rem;
Expand Down
23 changes: 17 additions & 6 deletions src/components/ShoeGrid/ShoeGrid.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import React from 'react';
import styled from 'styled-components/macro';
import React from "react";
import styled from "styled-components/macro";

import SHOES from '../../data';
import ShoeCard from '../ShoeCard';
import SHOES from "../../data";
import ShoeCard from "../ShoeCard";

const ShoeGrid = () => {
return (
<Wrapper>
{SHOES.map((shoe) => (
<ShoeCard key={shoe.slug} {...shoe} />
<ShoeWrapper key={shoe.slug}>
<ShoeCard {...shoe} />
</ShoeWrapper>
))}
</Wrapper>
);
};

const Wrapper = styled.div``;
const Wrapper = styled.div`
display: flex;
flex-wrap: wrap;
gap: 32px;
`;

const ShoeWrapper = styled.div`
min-width: 275px;
flex: 1;
`;

export default ShoeGrid;