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

Attempt 1 #14

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21,235 changes: 21,204 additions & 31 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"styled-components": "5.2.1"
},
"scripts": {
"start": "react-scripts start",
"start": "NODE_OPTIONS=--openssl-legacy-provider react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
Expand Down
19 changes: 12 additions & 7 deletions src/components/Header/Header.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 Logo from '../Logo';
import SuperHeader from '../SuperHeader';
import { COLORS, WEIGHTS } from "../../constants";
import Logo from "../Logo";
import SuperHeader from "../SuperHeader";

const Header = () => {
// Our site features two visual headers, but they should be
Expand All @@ -27,18 +27,23 @@ const Header = () => {
};

const MainHeader = styled.div`
padding: 0 32px;
padding: 12px 32px;
border-bottom: 1px solid ${COLORS.gray[300]};
display: flex;
align-items: center;
`;

const Nav = styled.nav``;
const Nav = styled.nav`
margin: 0 auto;
`;

const NavLink = styled.a`
font-size: 1.125rem;
text-transform: uppercase;
text-decoration: none;
color: ${COLORS.gray[900]};
font-weight: ${WEIGHTS.medium};
padding: 0 16px;

&:first-of-type {
color: ${COLORS.secondary};
Expand Down
10 changes: 5 additions & 5 deletions src/components/SearchInput/SearchInput.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 } from '../../constants';
import VisuallyHidden from '../VisuallyHidden';
import Icon from '../Icon';
import { COLORS } from "../../constants";
import VisuallyHidden from "../VisuallyHidden";
import Icon from "../Icon";

const SearchInput = ({ label, ...delegated }) => {
return (
Expand Down
23 changes: 10 additions & 13 deletions src/components/Select/Select.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
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 Icon from '../Icon';
import { COLORS, WEIGHTS } from "../../constants";
import Icon from "../Icon";

const Select = ({ label, value, children, ...delegated }) => {
const childArray = React.Children.toArray(children);
const selectedChild = childArray.find(
(child) => child.props.value === value
);
const selectedChild = childArray.find((child) => child.props.value === value);

const displayedValue = selectedChild.props.children;

Expand All @@ -21,18 +19,17 @@ const Select = ({ label, value, children, ...delegated }) => {

<DisplayedBit>
{displayedValue}
<ChevronIcon
id="chevron-down"
size={24}
strokeWidth={1.5}
/>
<ChevronIcon id="chevron-down" size={24} strokeWidth={1.5} />
</DisplayedBit>
</SelectWrapper>
</Wrapper>
);
};

const Wrapper = styled.label``;
const Wrapper = styled.label`
display: flex;
align-items: center;
`;

const VisibleLabel = styled.span`
color: ${COLORS.gray[700]};
Expand Down
53 changes: 44 additions & 9 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 @@ -33,17 +33,29 @@ const ShoeCard = ({

return (
<Link href={`/shoe/${slug}`}>
{variant !== "default" ? (
variant === "on-sale" ? (
<Banner type="sale">Sale</Banner>
) : (
<Banner type="newRelease">Just Released!</Banner>
)
) : (
""
)}
<Wrapper>
<ImageWrapper>
<Image alt="" src={imageSrc} />
</ImageWrapper>
<Spacer size={12} />
<Row>
<Name>{name}</Name>
<Price>{formatPrice(price)}</Price>
<Price crossedOut={variant === "on-sale"}>{formatPrice(price)}</Price>
</Row>
<Row>
<ColorInfo>{pluralize('Color', numOfColors)}</ColorInfo>
<ColorInfo>{pluralize("Color", numOfColors)}</ColorInfo>
{variant === "on-sale" && (
<SalePrice>{formatPrice(salePrice)}</SalePrice>
)}
</Row>
</Wrapper>
</Link>
Expand All @@ -53,6 +65,9 @@ const ShoeCard = ({
const Link = styled.a`
text-decoration: none;
color: inherit;
display: flex;
flex: 1 1 400px;
position: relative;
`;

const Wrapper = styled.article``;
Expand All @@ -61,18 +76,25 @@ const ImageWrapper = styled.div`
position: relative;
`;

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

const Row = styled.div`
font-size: 1rem;
display: flex;
justify-content: space-between;
`;

const Name = styled.h3`
font-weight: ${WEIGHTS.medium};
color: ${COLORS.gray[900]};
`;

const Price = styled.span``;
const Price = styled.span`
text-decoration: ${(props) => (props.crossedOut ? "line-through" : "none")};
color: ${(props) => (props.crossedOut ? COLORS.gray[700] : "black")};
`;

const ColorInfo = styled.p`
color: ${COLORS.gray[700]};
Expand All @@ -83,4 +105,17 @@ const SalePrice = styled.span`
color: ${COLORS.primary};
`;

const Banner = styled.span`
background-color: ${(props) =>
props.type === "sale" ? COLORS.primary : COLORS.secondary};
position: absolute;
top: 20px;
right: -6px;
border-radius: 2px;
z-index: 1;
color: white;
padding: 6px;
font-weight: ${WEIGHTS.medium};
`;

export default ShoeCard;
14 changes: 9 additions & 5 deletions src/components/ShoeGrid/ShoeGrid.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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 (
Expand All @@ -14,6 +14,10 @@ const ShoeGrid = () => {
);
};

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

export default ShoeGrid;
41 changes: 26 additions & 15 deletions src/components/ShoeIndex/ShoeIndex.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import styled from 'styled-components/macro';
import React from "react";
import styled from "styled-components/macro";

import { WEIGHTS } from '../../constants';
import { WEIGHTS } from "../../constants";

import Breadcrumbs from '../Breadcrumbs';
import Select from '../Select';
import Spacer from '../Spacer';
import ShoeSidebar from '../ShoeSidebar';
import ShoeGrid from '../ShoeGrid';
import Breadcrumbs from "../Breadcrumbs";
import Select from "../Select";
import Spacer from "../Spacer";
import ShoeSidebar from "../ShoeSidebar";
import ShoeGrid from "../ShoeGrid";

const ShoeIndex = ({ sortId, setSortId }) => {
return (
Expand All @@ -31,9 +31,7 @@ const ShoeIndex = ({ sortId, setSortId }) => {
<Breadcrumbs>
<Breadcrumbs.Crumb href="/">Home</Breadcrumbs.Crumb>
<Breadcrumbs.Crumb href="/sale">Sale</Breadcrumbs.Crumb>
<Breadcrumbs.Crumb href="/sale/shoes">
Shoes
</Breadcrumbs.Crumb>
<Breadcrumbs.Crumb href="/sale/shoes">Shoes</Breadcrumbs.Crumb>
</Breadcrumbs>
<Spacer size={42} />
<ShoeSidebar />
Expand All @@ -42,17 +40,30 @@ const ShoeIndex = ({ sortId, setSortId }) => {
);
};

const Wrapper = styled.div``;
const Wrapper = styled.div`
display: flex;
align-items: baseline;
gap: 60px;
`;

const LeftColumn = styled.div``;
const LeftColumn = styled.div`
display: flex;
flex-direction: column;
`;

const MainColumn = styled.div``;
const MainColumn = styled.div`
flex: 1;
order: 1;
`;

const Header = styled.header``;
const Header = styled.header`
display: flex;
`;

const Title = styled.h2`
font-size: 1.5rem;
font-weight: ${WEIGHTS.medium};
margin-right: auto;
`;

export default ShoeIndex;
17 changes: 11 additions & 6 deletions src/components/SuperHeader/SuperHeader.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import styled from 'styled-components';
import React from "react";
import styled from "styled-components";

import { COLORS } from '../../constants';
import { COLORS } from "../../constants";

import SearchInput from '../SearchInput';
import UnstyledButton from '../UnstyledButton';
import Icon from '../Icon';
import SearchInput from "../SearchInput";
import UnstyledButton from "../UnstyledButton";
import Icon from "../Icon";

const SuperHeader = () => {
return (
Expand All @@ -26,10 +26,15 @@ const Wrapper = styled.div`
font-size: 0.875rem;
color: ${COLORS.gray[300]};
background-color: ${COLORS.gray[900]};
display: flex;
padding: 12px 32px;
align-items: center;
gap: 20px;
`;

const MarketingMessage = styled.span`
color: ${COLORS.white};
margin-right: auto;
`;

const HelpLink = styled.a`
Expand Down