Skip to content

Update: add directory component, routes and fragments #215

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

Open
wants to merge 4 commits into
base: lesson-1
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
33,974 changes: 21,746 additions & 12,228 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"@testing-library/jest-dom": "5.16.1",
"@testing-library/react": "12.1.2",
"@testing-library/user-event": "13.5.0",
"firebase": "^10.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.15.0",
"react-scripts": "5.0.0",
"sass": "^1.64.2",
"web-vitals": "2.1.4"
},
"scripts": {
Expand Down
46 changes: 25 additions & 21 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--

<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -24,12 +22,17 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,800;1,300&display=swap"
rel="stylesheet">
<title>React App</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

Expand All @@ -39,5 +42,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</body>

</html>
59 changes: 22 additions & 37 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
const App = () => {
import { Routes, Route } from 'react-router-dom'

import Home from './routes/home/home.component'
import Navigation from './routes/navigation/navigation.component';
import Authentication from './routes/authentication/authentication.component';

export const Shop = () => {
return (
<div className='categories-container'>
<div className='category-container'>
{/* <img /> */}
<div className='category-body-container'>
<h2>Hats</h2>
<p>Shop Now</p>
</div>
</div>
<div className='category-container'>
{/* <img /> */}
<div className='category-body-container'>
<h2>Jackets</h2>
<p>Shop Now</p>
</div>
</div>
<div className='category-container'>
{/* <img /> */}
<div className='category-body-container'>
<h2>Sneakers</h2>
<p>Shop Now</p>
</div>
</div>
<div className='category-container'>
{/* <img /> */}
<div className='category-body-container'>
<h2>Womens</h2>
<p>Shop Now</p>
</div>
</div>
<div className='category-container'>
{/* <img /> */}
<div className='category-body-container'>
<h2>Mens</h2>
<p>Shop Now</p>
</div>
</div>
<div>
<h1>Shop</h1>
</div>
)
}

const App = () => {

return (
<Routes>
<Route path='/' element={<Navigation />} >
<Route index element={<Home />} />
<Route path='shop' element={<Shop />} />
<Route path='auth' element={<Authentication />} />
</Route>
</Routes>
);
};

Expand Down
17 changes: 17 additions & 0 deletions src/assets/crown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added src/categories.style.scss
Empty file.
18 changes: 18 additions & 0 deletions src/components/button/button.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import './button.style.scss'

const BUTTON_TYPES_CLASES = {
google: 'google-sign-in',
inverted: 'inverted'
}

const Button = ({ children, buttonType, ...otherProps }) => {
return (
<button className={`button-container ${BUTTON_TYPES_CLASES[buttonType]}`}
{...otherProps}
>
{children}
</button>
);
}

export default Button;
46 changes: 46 additions & 0 deletions src/components/button/button.style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.button-container {
min-width: 165px;
width: auto;
height: 50px;
letter-spacing: 0.5px;
line-height: 50px;
padding: 0 35px 0 35px;
font-size: 15px;
background-color: black;
color: white;
text-transform: uppercase;
font-family: "Open Sans Condensed";
font-weight: bolder;
border: none;
cursor: pointer;
display: flex;
justify-content: center;

&:hover {
background-color: white;
color: black;
border: 1px solid black;
}

&.google-sign-in {
background-color: #4285f4;
color: white;

&:hover {
background-color: #357ae8;
border: none;
}
}

&.inverted {
background-color: white;
color: black;
border: 1px solid black;

&:hover {
background-color: black;
color: white;
border: none;
}
}
}
68 changes: 68 additions & 0 deletions src/components/category-item/categories-item.style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.category-container {
min-width: 30%;
height: 240px;
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid black;
margin: 0 7.5px 15px;
overflow: hidden;

&:hover {
cursor: pointer;

& .background-image {
transform: scale(1.1);
transition: transform 6s cubic-bezier(0.25, 0.45, 0.45, 0.95);
}

& .category-body-container {
opacity: 0.9;
}
}

&.large {
height: 380px;
}

&:first-child {
margin-right: 7.5px;
}

&:last-child {
margin-left: 7.5px;
}

.background-image {
width: 100%;
height: 100%;
background-size: cover;
background-position: center;
}

.category-body-container {
height: 90px;
padding: 0 25px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border: 1px solid black;
background-color: white;
opacity: 0.7;
position: absolute;

h2 {
font-weight: bold;
margin: 0 6px 0;
font-size: 22px;
color: #4a4a4a;
}

p {
font-weight: lighter;
font-size: 16px;
}
}
}
20 changes: 20 additions & 0 deletions src/components/category-item/category-item.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import './categories-item.style.scss'

const CategoriesItem = ({ category }) => {

const { imageUrl, title } = category;

return (
<div className='category-container'>
<div className="background-image" style={{
backgroundImage: `url(${imageUrl})`
}} />
<div className='category-body-container'>
<h2>{title}</h2>
<p>Shop Now</p>
</div>
</div>
)
}

export default CategoriesItem;
16 changes: 16 additions & 0 deletions src/components/directory/directory.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import CategoriesItem from '../category-item/category-item.component'

import './directory.style.scss'

const Directory = ({ categories }) => {
return (
<div className='directory-container'>
{categories.map((category) => (
<CategoriesItem key={category.id} category={category} />
))}
</div>
)
}

export default Directory
6 changes: 6 additions & 0 deletions src/components/directory/directory.style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.directory-container {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
14 changes: 14 additions & 0 deletions src/components/form-input/form-input.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import './form-input.style.scss'

const FormInput = ({ label, ...otherProps }) => {
return (
<div className="group">
<input className="form-input" {...otherProps} />
{label && (
<label className={`${otherProps.value.length ? 'shrink' : ''} form-input-label`}>{label}</label>
)}
</div>
);
}

export default FormInput;
Loading