├── .gitignore ├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── src ├── Assets │ ├── burguer.png │ ├── combo.png │ ├── drink.png │ ├── pizza.png │ ├── desserts.png │ ├── drinks-icon.svg │ ├── burguers-icon.svg │ ├── desserts-icon.svg │ ├── pizza-icon.svg │ └── combos-icon.svg ├── index.js ├── Components │ ├── Checkout │ │ ├── Form │ │ │ ├── Fragments │ │ │ │ ├── RadioPayment.module.css │ │ │ │ ├── RadioDelivery.module.css │ │ │ │ ├── Input.js │ │ │ │ ├── Input.module.css │ │ │ │ ├── RadioPayment.js │ │ │ │ ├── AddressDefault.module.css │ │ │ │ ├── AddressDefault.js │ │ │ │ ├── Address.module.css │ │ │ │ ├── RadioDelivery.js │ │ │ │ └── Address.js │ │ │ ├── Form.module.css │ │ │ └── Form.js │ │ ├── Checkout.js │ │ └── Checkout.module.css │ ├── Home │ │ ├── Product │ │ │ ├── Products.module.css │ │ │ ├── ProductItem.js │ │ │ ├── Products.js │ │ │ └── ProductItem.module.css │ │ ├── Cart │ │ │ ├── ObsItem.js │ │ │ ├── CartItem.js │ │ │ ├── ObsItem.module.css │ │ │ ├── Cart.js │ │ │ ├── CartItem.module.css │ │ │ └── Cart.module.css │ │ ├── Nav │ │ │ ├── HomeNav.module.css │ │ │ └── HomeNav.js │ │ ├── Home.module.css │ │ └── Home.js │ └── Finish │ │ ├── Finish.js │ │ └── Finish.module.css ├── App.css ├── Hooks │ ├── useMedia.js │ └── useForm.js ├── App.js └── GlobalContext.js ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_* 2 | *.log 3 | logs 4 | /node_modules 5 | /build -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/Assets/burguer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/src/Assets/burguer.png -------------------------------------------------------------------------------- /src/Assets/combo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/src/Assets/combo.png -------------------------------------------------------------------------------- /src/Assets/drink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/src/Assets/drink.png -------------------------------------------------------------------------------- /src/Assets/pizza.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/src/Assets/pizza.png -------------------------------------------------------------------------------- /src/Assets/desserts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMafra/RDelivery-frontend-ReactJS/HEAD/src/Assets/desserts.png -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | ReactDOM.render( 6 | 7 | 8 | , 9 | document.getElementById('root') 10 | ); 11 | -------------------------------------------------------------------------------- /src/Components/Checkout/Form/Fragments/RadioPayment.module.css: -------------------------------------------------------------------------------- 1 | .radioPayment { 2 | margin-top: 24px; 3 | } 4 | 5 | .radio { 6 | cursor: pointer; 7 | margin-right: 12px; 8 | } 9 | 10 | .label { 11 | color: #848484; 12 | font-size: 16px; 13 | } 14 | 15 | .label:nth-child(2){ 16 | margin-left: 54px; 17 | } -------------------------------------------------------------------------------- /src/Components/Checkout/Form/Fragments/RadioDelivery.module.css: -------------------------------------------------------------------------------- 1 | .radioDelivery { 2 | margin-top: 24px; 3 | } 4 | 5 | .radio { 6 | cursor: pointer; 7 | margin-right: 12px; 8 | } 9 | 10 | .label { 11 | color: #848484; 12 | font-size: 16px; 13 | } 14 | 15 | .label:nth-child(2){ 16 | margin-left: 54px; 17 | } -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap'); 2 | 3 | * { 4 | margin: 0; 5 | padding: 0; 6 | box-sizing: border-box; 7 | } 8 | 9 | body { 10 | font-family: 'Poppins', sans-serif; 11 | } 12 | 13 | img { 14 | display: block; 15 | max-width: 100%; 16 | } -------------------------------------------------------------------------------- /src/Hooks/useMedia.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const useMedia = (media) => { 4 | const [match, setMatch] = React.useState(null); 5 | 6 | React.useEffect(() => { 7 | function changeMatch() { 8 | const { matches } = window.matchMedia(media); 9 | setMatch(matches); 10 | } 11 | changeMatch(); 12 | window.addEventListener('resize', changeMatch); 13 | return () => { 14 | window.removeEventListener('resize', changeMatch); 15 | } 16 | }, [media]); 17 | 18 | return match; 19 | } 20 | 21 | export default useMedia; -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/Components/Checkout/Form/Fragments/Input.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './Input.module.css'; 3 | 4 | const Input = ({ label, type, name, value, placeholder, onChange, error, onBlur }) => { 5 | return ( 6 |
7 | 8 | 9 | {error &&

{error}

} 10 |
11 | ) 12 | } 13 | 14 | export default Input; -------------------------------------------------------------------------------- /src/Components/Home/Product/Products.module.css: -------------------------------------------------------------------------------- 1 | .products { 2 | width: 70%; 3 | padding: 48px 85px 0px 85px; 4 | margin-left: 129px; 5 | } 6 | 7 | .title { 8 | font-weight: 600; 9 | font-size: 24px; 10 | margin-bottom: 36px; 11 | } 12 | 13 | .areaProducts { 14 | display: flex; 15 | flex-wrap: wrap; 16 | } 17 | 18 | @media (max-width: 480px){ 19 | 20 | .products { 21 | padding: 0px; 22 | margin-left: 0; 23 | } 24 | 25 | .title { 26 | margin-bottom: 0; 27 | margin-top: 32px; 28 | margin-left: 16px; 29 | } 30 | 31 | .areaProducts { 32 | width: 100vw; 33 | justify-content: center; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/Components/Home/Product/ProductItem.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './ProductItem.module.css'; 3 | 4 | const ProductItem = ({ inputCart, item }) => { 5 | return ( 6 |
inputCart(item) : () => false}> 7 | {item.offer &&

Oferta

} 8 | {item.title} 9 |
10 |

{item.title}

11 |

{item.description}

12 |

R$ {item.price},00

13 |
14 |
15 | ); 16 | }; 17 | 18 | export default ProductItem; -------------------------------------------------------------------------------- /src/Components/Checkout/Form/Fragments/Input.module.css: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | margin-bottom: 20px; 3 | } 4 | 5 | .input { 6 | border: 1px solid #dadada; 7 | display: block; 8 | width: 100%; 9 | font-size: 16px; 10 | padding: 12px 16px; 11 | border-radius: 8px; 12 | background: transparent; 13 | transition: 0.3s; 14 | } 15 | 16 | .input::placeholder { 17 | font-family: 'Poppins'; 18 | font-size: 16px; 19 | color: #848484; 20 | } 21 | 22 | .input:focus, 23 | .input:hover { 24 | outline: none; 25 | border-color: #fdc844; 26 | background: transparent; 27 | 28 | } 29 | 30 | .label { 31 | display: block; 32 | font-weight: 500; 33 | line-height: 1; 34 | padding-bottom: 8px; 35 | } 36 | 37 | .error { 38 | color: #ff2351; 39 | font-size: 14px; 40 | margin-top: 4px; 41 | } -------------------------------------------------------------------------------- /src/Components/Checkout/Checkout.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import useMedia from '../../Hooks/useMedia'; 4 | import Cart from '../Home/Cart/Cart'; 5 | import Form from './Form/Form'; 6 | import styles from './Checkout.module.css'; 7 | 8 | const Checkout = () => { 9 | const mobile = useMedia('(max-width: 480px)'); 10 | 11 | return ( 12 |
13 |
14 | ← Voltar 15 |
16 |
17 |
18 |
19 | {!mobile ? ( 20 | 21 | ) : ( 22 | '' 23 | )} 24 |
25 | ); 26 | }; 27 | 28 | export default Checkout; -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './App.css'; 3 | import { BrowserRouter, Routes, Route } from 'react-router-dom'; 4 | import Home from './Components/Home/Home'; 5 | import Checkout from './Components/Checkout/Checkout'; 6 | import Finish from './Components/Finish/Finish'; 7 | import { GlobalStorage } from './GlobalContext'; 8 | 9 | function App() { 10 | return ( 11 | 12 | 13 | 14 | } /> 15 | } /* this route is only for use on GitHub Pages */ /> 16 | } /> 17 | } /> 18 | 19 | 20 | 21 | ); 22 | } 23 | 24 | export default App; 25 | -------------------------------------------------------------------------------- /src/Components/Checkout/Form/Fragments/RadioPayment.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { GlobalContext } from '../../../../GlobalContext'; 3 | import styles from './RadioPayment.module.css'; 4 | 5 | const RadioPayment = () => { 6 | const { typePayment, setTypePayment } = React.useContext(GlobalContext); 7 | 8 | return ( 9 |
10 | 14 | 18 |
19 | ) 20 | } 21 | 22 | export default RadioPayment; -------------------------------------------------------------------------------- /src/Components/Checkout/Form/Fragments/AddressDefault.module.css: -------------------------------------------------------------------------------- 1 | .defaultAddress { 2 | font-weight: 600; 3 | margin-top: 24px; 4 | margin-bottom: 14px; 5 | } 6 | 7 | .cardAddress { 8 | border: 1px solid #dadada; 9 | border-radius: 8px; 10 | padding: 16px 32px; 11 | width: 60%; 12 | margin-top: 32px; 13 | } 14 | 15 | .cardAddress p { 16 | color: #848484; 17 | } 18 | 19 | .cardAddress p:nth-child(2), 20 | .cardAddress p:nth-child(3){ 21 | margin-top: 8px; 22 | } 23 | 24 | .editAddress { 25 | border: none; 26 | background-color: transparent; 27 | font-size: 12px; 28 | color: #ff2351; 29 | text-decoration: underline; 30 | cursor: pointer; 31 | } 32 | 33 | .subTitle { 34 | line-height: 1; 35 | margin-top: 52px; 36 | } 37 | 38 | .typePay { 39 | font-weight: 600; 40 | margin-top: 24px; 41 | margin-bottom: 14px; 42 | } 43 | 44 | @media (max-width: 480px){ 45 | 46 | .cardAddress { 47 | width: 100%; 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /src/Components/Checkout/Checkout.module.css: -------------------------------------------------------------------------------- 1 | .checkout { 2 | background-color: #fafafa; 3 | display: flex; 4 | height: 100vh; 5 | } 6 | 7 | .mainCheckout { 8 | margin-top: 16px; 9 | margin-left: 16px; 10 | } 11 | 12 | .mainCheckout a { 13 | text-decoration: none; 14 | color: #000; 15 | font-weight: 600; 16 | font-size: 24px; 17 | } 18 | 19 | .formArea { 20 | margin-top: 32px; 21 | margin-left: 64px; 22 | justify-self: center; 23 | } 24 | 25 | @keyframes enterLeft { 26 | to { 27 | opacity: 1; 28 | transform: initial; 29 | } 30 | } 31 | 32 | @media (max-width: 480px){ 33 | 34 | .checkout { 35 | height: auto; 36 | } 37 | 38 | .openCheckout { 39 | display: block; 40 | opacity: 0; 41 | transform: translateX(500px); 42 | animation: enterLeft .3s forwards; 43 | } 44 | 45 | .mainCheckout { 46 | height: 100%; 47 | margin: 16px 0px 0px 0px; 48 | } 49 | 50 | .formArea{ 51 | margin-left: 0px; 52 | max-width: 100vw; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /src/Components/Home/Cart/ObsItem.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { GlobalContext } from '../../../GlobalContext'; 3 | import styles from './ObsItem.module.css'; 4 | 5 | const ObsItem = () => { 6 | const { openObs, setOpenObs, idObs, obs, setObs, addObs } = React.useContext(GlobalContext); 7 | 8 | function closeObsBox() { 9 | setOpenObs(!openObs); 10 | } 11 | 12 | function saveObs() { 13 | addObs(idObs); 14 | closeObsBox(); 15 | } 16 | 17 | return ( 18 |
19 |
20 | 21 |

Adicionar observação

22 |