├── public
├── favicon.ico
├── robots.txt
├── Quicksand-Light.woff
├── Quicksand-Light.woff2
└── index.html
├── src
├── components
│ ├── variants
│ │ └── animationVariant.js
│ ├── Header.js
│ ├── Home.js
│ ├── Order.js
│ ├── Toppings.js
│ └── Base.js
├── index.js
├── App.js
└── index.css
├── .gitignore
├── package.json
└── README.md
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zdnahom/pizzajoint/main/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/public/Quicksand-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zdnahom/pizzajoint/main/public/Quicksand-Light.woff
--------------------------------------------------------------------------------
/public/Quicksand-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zdnahom/pizzajoint/main/public/Quicksand-Light.woff2
--------------------------------------------------------------------------------
/src/components/variants/animationVariant.js:
--------------------------------------------------------------------------------
1 | export const baseContainerVariant = {
2 | initial: {
3 | x: "100vw",
4 | opacity: 0,
5 | },
6 | final: {
7 | x: 0,
8 | opacity: 1,
9 | transition: {
10 | when: "beforeChildren",
11 | type: "spring",
12 | stiffness: 120,
13 | // delay: 0.5,
14 | },
15 | },
16 | };
17 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import { BrowserRouter as Router } from 'react-router-dom';
6 |
7 | ReactDOM.render(
8 |
9 |
10 |
11 |
12 | ,
13 | document.getElementById('root')
14 | );
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/src/components/Header.js:
--------------------------------------------------------------------------------
1 | import { motion } from "framer-motion";
2 | import React from "react";
3 |
4 | const Header = () => {
5 | return (
6 |
7 |
20 |
21 | Pizza Joint
22 |
23 |
24 | );
25 | };
26 |
27 | export default Header;
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ninjajoint",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.5.0",
8 | "@testing-library/user-event": "^7.2.1",
9 | "framer-motion": "^1.11.1",
10 | "react": "^16.13.1",
11 | "react-dom": "^16.13.1",
12 | "react-router-dom": "^5.1.2",
13 | "react-scripts": "3.4.1"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test",
19 | "eject": "react-scripts eject"
20 | },
21 | "eslintConfig": {
22 | "extends": "react-app"
23 | },
24 | "browserslist": {
25 | "production": [
26 | ">0.2%",
27 | "not dead",
28 | "not op_mini all"
29 | ],
30 | "development": [
31 | "last 1 chrome version",
32 | "last 1 firefox version",
33 | "last 1 safari version"
34 | ]
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/components/Home.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Link } from "react-router-dom";
3 | import { motion } from "framer-motion";
4 |
5 | const homeContainerVariant = {
6 | initial: {
7 | opacity: 0,
8 | },
9 | visible: {
10 | opacity: 1,
11 | transition: {
12 | delay: 1.5,
13 | duration: 2,
14 | },
15 | },
16 | };
17 |
18 | const Home = () => {
19 | return (
20 |
29 | Welcome to Pizza Joint
30 |
31 |
38 | Create Your Pizza
39 |
40 |
41 |
42 | );
43 | };
44 |
45 | export default Home;
46 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Route, Switch } from "react-router-dom";
3 | import Header from './components/Header';
4 | import Home from './components/Home';
5 | import Base from './components/Base';
6 | import Toppings from './components/Toppings';
7 | import Order from './components/Order';
8 |
9 | function App() {
10 | const [pizza, setPizza] = useState({ base: "", toppings: [] });
11 |
12 | const addBase = (base) => {
13 | setPizza({ ...pizza, base })
14 | }
15 |
16 | const addTopping = (topping) => {
17 | let newToppings;
18 | if(!pizza.toppings.includes(topping)){
19 | newToppings = [...pizza.toppings, topping];
20 | } else {
21 | newToppings = pizza.toppings.filter(item => item !== topping);
22 | }
23 | setPizza({ ...pizza, toppings: newToppings });
24 | }
25 |
26 | return (
27 | <>
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | >
44 | );
45 | }
46 |
47 | export default App;
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
17 | React App
18 |
19 |
20 |
21 |
22 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/components/Order.js:
--------------------------------------------------------------------------------
1 | import { motion } from "framer-motion";
2 | import React from "react";
3 | // import { baseContainerVariant } from "./variants/animationVariant";
4 | const baseContainerVariant = {
5 | initial: {
6 | x: "100vw",
7 | opacity: 0,
8 | },
9 | final: {
10 | x: 0,
11 | opacity: 1,
12 | transition: {
13 | when: "beforeChildren",
14 | type: "spring",
15 | stiffness: 120,
16 | // delay: 0.5,
17 |
18 | // higher mass refers it moves slower and lower mass refers it moves faster
19 | mass:0.8,
20 |
21 | //higer daming means a lower oscilation
22 | damping:8,
23 | staggerChildren:1
24 | },
25 | },
26 | };
27 |
28 | const childVariants = {
29 | initial: {
30 | opacity: 0,
31 | },
32 | final: {
33 | opacity: 1,
34 |
35 | },
36 | };
37 |
38 | const Order = ({ pizza }) => {
39 | return (
40 |
46 | Thank you for your order :)
47 | You ordered a {pizza.base} pizza with:
48 |
49 | {pizza.toppings.map((topping) => (
50 | {topping}
51 | ))}
52 |
53 |
54 | );
55 | };
56 |
57 | export default Order;
58 |
--------------------------------------------------------------------------------
/src/components/Toppings.js:
--------------------------------------------------------------------------------
1 | import { motion } from "framer-motion";
2 | import React from "react";
3 | import { Link } from "react-router-dom";
4 | // import { baseContainerVariant } from "./variants/animationVariant";
5 | export const baseContainerVariant = {
6 | initial: {
7 | x: "100vw",
8 | opacity: 0,
9 | },
10 | final: {
11 | x: 0,
12 | opacity: 1,
13 | transition: {
14 | when: "beforeChildren",
15 | type: "spring",
16 | stiffness: 120,
17 | // delay: 0.5,
18 | },
19 | },
20 | };
21 |
22 |
23 |
24 | const Toppings = ({ addTopping, pizza }) => {
25 | let toppings = [
26 | "mushrooms",
27 | "peppers",
28 | "onions",
29 | "olives",
30 | "extra cheese",
31 | "tomatoes",
32 | ];
33 |
34 | return (
35 |
40 | Step 2: Choose Toppings
41 |
42 | {toppings.map((topping) => {
43 | let spanClass = pizza.toppings.includes(topping) ? "active" : "";
44 | return (
45 | addTopping(topping)}
48 | whileHover={{ scale: 1.4, originX: 0, color: "yellow" }}
49 | transition={{type:'spring',stiffness:300}}
50 |
51 | >
52 | {topping}
53 |
54 | );
55 | })}
56 |
57 |
58 |
59 |
66 | Order
67 |
68 |
69 |
70 | );
71 | };
72 |
73 | export default Toppings;
74 |
--------------------------------------------------------------------------------
/src/components/Base.js:
--------------------------------------------------------------------------------
1 | import { motion } from "framer-motion";
2 | import React from "react";
3 | import { Link } from "react-router-dom";
4 | const baseContainerVariant = {
5 | initial: {
6 | x: "100vw",
7 | opacity: 0,
8 | },
9 | final: {
10 | x: 0,
11 | opacity: 1,
12 | transition: {
13 | type: "spring",
14 | stiffness: 120,
15 | delay: 0.5,
16 | },
17 | },
18 | };
19 | const nextVariant = {
20 | initial: {
21 | x: "-100vw",
22 | },
23 | final: {
24 | x: 0,
25 | transition: {
26 | type: "spring",
27 | stiffness: 120,
28 | },
29 | },
30 | };
31 | const Base = ({ addBase, pizza }) => {
32 | const bases = ["Classic", "Thin & Crispy", "Thick Crust"];
33 |
34 | return (
35 |
42 | Step 1: Choose Your Base
43 |
44 | {bases.map((base) => {
45 | let spanClass = pizza.base === base ? "active" : "";
46 | return (
47 | addBase(base)}
50 | whileHover={{ scale: 1.2, originX: 0, color: "yellow" }}
51 | transition={{ type: "spring", stiffness: 300 }}
52 | >
53 | {base}
54 |
55 | );
56 | })}
57 |
58 |
59 | {pizza.base && (
60 |
67 |
68 |
75 | Next
76 |
77 |
78 |
79 | )}
80 |
81 | );
82 | };
83 |
84 | export default Base;
85 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | /* fonts */
2 | @font-face {
3 | font-family: 'Quicksand';
4 | src: url('/Quicksand-Light.woff2') format('woff2'),
5 | url('/Quicksand-Light.woff') format('woff');
6 | font-weight: 300;
7 | font-style: normal;
8 | }
9 |
10 | /* reset & common styles */
11 | body, ul, h1, h2, h3, p, button, a, div{
12 | margin: 0;
13 | padding: 0;
14 | color: white;
15 | font-family: 'Quicksand';
16 | letter-spacing: 2px;
17 | list-style-type: none;
18 | text-decoration: none;
19 | }
20 | body{
21 | background: rgb(100,0,123);
22 | background: radial-gradient(circle, rgba(100,0,123,1) 0%, rgba(62,20,86,1) 100%);
23 | overflow: hidden;
24 | }
25 | button{
26 | color: white;
27 | padding: 10px 30px;
28 | font-size: 1em;
29 | background: transparent;
30 | border-radius: 50px;
31 | border: 1px solid white;
32 | margin: 40px auto 0;
33 | cursor: pointer;
34 | opacity: 0.7;
35 | }
36 | .container{
37 | max-width: 300px;
38 | margin: 100px auto 40px;
39 | }
40 | .container h3{
41 | padding-bottom: 10px;
42 | margin-bottom: 10px;
43 | border-bottom: 1px solid rgba(255,255,255,0.2);
44 | }
45 | .container li{
46 | padding: 10px;
47 | cursor: pointer;
48 | }
49 |
50 | /* header */
51 | header{
52 | display: flex;
53 | padding: 40px;
54 | align-items: center;
55 | }
56 | header .title{
57 | flex-grow: 1;
58 | margin-left: 20px;
59 | font-size: 0.6em;
60 | }
61 | header h1{
62 | border-bottom: 1px solid rgba(255,255,255,0.2);
63 | padding-bottom: 10px;
64 | }
65 | header .pizza-svg {
66 | width: 80px;
67 | overflow: visible;
68 | stroke: #fff;
69 | stroke-width: 4;
70 | stroke-linejoin: round;
71 | stroke-linecap: round;
72 | }
73 |
74 | /* lists */
75 | li span.active{
76 | font-weight: bold;
77 | }
78 | li span.active::before{
79 | content: '>';
80 | position: relative;
81 | top: -2px;
82 | margin-right: 6px;
83 | transform: scale(0.8, 1);
84 | display: inline-block;
85 | }
86 |
87 | /* pages */
88 | .home h2{
89 | font-size: 2em;
90 | margin-bottom: 30px;
91 | }
92 | .home.container,
93 | .order.container{
94 | text-align: center;
95 | max-width: 800px;
96 | }
97 | .home button{
98 | color: white;
99 | padding: 15px 30px;
100 | font-size: 1.6em;
101 | border: 3px solid white;
102 | margin: 30px 20px;
103 | }
104 | .order p{
105 | margin: 20px auto;
106 | }
107 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2 |
3 | ## Available Scripts
4 |
5 | In the project directory, you can run:
6 |
7 | ### `npm start`
8 |
9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11 |
12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console.
14 |
15 | ### `npm test`
16 |
17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19 |
20 | ### `npm run build`
21 |
22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance.
24 |
25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed!
27 |
28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29 |
30 | ### `npm run eject`
31 |
32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33 |
34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35 |
36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37 |
38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39 |
40 | ## Learn More
41 |
42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43 |
44 | To learn React, check out the [React documentation](https://reactjs.org/).
45 |
46 | ### Code Splitting
47 |
48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49 |
50 | ### Analyzing the Bundle Size
51 |
52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53 |
54 | ### Making a Progressive Web App
55 |
56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57 |
58 | ### Advanced Configuration
59 |
60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61 |
62 | ### Deployment
63 |
64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65 |
66 | ### `npm run build` fails to minify
67 |
68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
69 |
--------------------------------------------------------------------------------