├── .prettierrc ├── public ├── favicon.ico ├── manifest.json ├── index.html └── ice-cream-images │ ├── ice-cream-3.svg │ ├── ice-cream-0.svg │ ├── ice-cream-5.svg │ ├── ice-cream-14.svg │ ├── ice-cream-1.svg │ ├── ice-cream-7.svg │ ├── ice-cream-10.svg │ ├── ice-cream-20.svg │ ├── ice-cream-6.svg │ ├── ice-cream-18.svg │ ├── ice-cream-4.svg │ ├── ice-cream-22.svg │ ├── ice-cream-19.svg │ ├── ice-cream-2.svg │ ├── ice-cream-24.svg │ ├── ice-cream-8.svg │ ├── ice-cream-23.svg │ └── ice-cream-11.svg ├── src ├── assets │ ├── fonts │ │ ├── cornerstone.woff │ │ ├── cornerstone.woff2 │ │ ├── kathen │ │ │ └── kathen.otf │ │ └── geomanist │ │ │ ├── geomanist-book.eot │ │ │ ├── geomanist-book.ttf │ │ │ ├── geomanist-book.woff │ │ │ ├── geomanist-book.woff2 │ │ │ ├── geomanist-medium.eot │ │ │ ├── geomanist-medium.ttf │ │ │ ├── geomanist-medium.woff │ │ │ ├── geomanist-medium.woff2 │ │ │ ├── geomanist-regular.eot │ │ │ ├── geomanist-regular.ttf │ │ │ ├── geomanist-regular.woff │ │ │ └── geomanist-regular.woff2 │ └── css │ │ └── style.css ├── index.js ├── ice-cream │ ├── __mocks__ │ │ ├── IceCreamImage.js │ │ └── IceCream.js │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── IceCreamImage.spec.js.snap │ │ ├── IceCreamImage.spec.js │ │ ├── IceCreamCardContainer.spec.js │ │ ├── IceCreamCard.spec.js │ │ ├── IceCreams.spec.js │ │ ├── Menu.spec.js │ │ ├── AddIceCream.spec.js │ │ ├── EditIceCream.spec.js │ │ └── IceCream.spec.js │ ├── IceCreamImage.js │ ├── ErrorContainer.js │ ├── IceCreamCardContainer.js │ ├── AddIceCream.js │ ├── IceCreams.js │ ├── EditIceCream.js │ ├── Menu.js │ └── IceCreamCard.js ├── structure │ ├── __mocks__ │ │ ├── FocusLink.js │ │ ├── Main.js │ │ └── LoaderMessage.js │ ├── __tests__ │ │ ├── Footer.spec.js │ │ ├── __snapshots__ │ │ │ ├── Footer.spec.js.snap │ │ │ ├── Header.spec.js.snap │ │ │ ├── Main.spec.js.snap │ │ │ └── FocusLink.spec.js.snap │ │ ├── Header.spec.js │ │ ├── Main.spec.js │ │ ├── LoaderMessage.spec.js │ │ └── FocusLink.spec.js │ ├── Footer.js │ ├── FocusLink.js │ ├── Main.js │ ├── LoaderMessage.js │ └── Header.js ├── hooks │ ├── useUniqueIds.js │ └── useValidation.js ├── __tests__ │ ├── app.spec.js │ └── __snapshots__ │ │ └── app.spec.js.snap ├── data │ ├── __mocks__ │ │ └── iceCreamData.js │ ├── iceCreamData.js │ └── __tests__ │ │ └── iceCreamData.spec.js ├── utils │ ├── validators.js │ └── __tests__ │ │ └── validators.spec.js ├── setupTests.js └── App.js ├── __mocks__ ├── axios.js └── react-router-dom.js ├── .gitignore ├── package.json ├── README.md └── server └── index.js /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5" 4 | } 5 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/fonts/cornerstone.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/cornerstone.woff -------------------------------------------------------------------------------- /src/assets/fonts/cornerstone.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/cornerstone.woff2 -------------------------------------------------------------------------------- /src/assets/fonts/kathen/kathen.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/kathen/kathen.otf -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-book.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-book.eot -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-book.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-book.ttf -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-book.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-book.woff -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-book.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-book.woff2 -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-medium.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-medium.eot -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-medium.ttf -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-medium.woff -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-medium.woff2 -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-regular.eot -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-regular.ttf -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-regular.woff -------------------------------------------------------------------------------- /src/assets/fonts/geomanist/geomanist-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ultimatecourses/ultimate-react-icecream/HEAD/src/assets/fonts/geomanist/geomanist-regular.woff2 -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /src/ice-cream/__mocks__/IceCreamImage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const IceCreamImage = ({ iceCreamId }) => ( 4 | 5 | ); 6 | 7 | export default IceCreamImage; 8 | -------------------------------------------------------------------------------- /src/structure/__mocks__/FocusLink.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const FocusLink = ({ to, children, ...props }) => ( 4 | 5 | {children} 6 | 7 | ); 8 | 9 | export default FocusLink; 10 | -------------------------------------------------------------------------------- /__mocks__/axios.js: -------------------------------------------------------------------------------- 1 | export default { 2 | get: jest.fn(() => Promise.resolve({ data: {} })), 3 | post: jest.fn(() => Promise.resolve({ data: {} })), 4 | put: jest.fn(() => Promise.resolve({ data: {} })), 5 | delete: jest.fn(() => Promise.resolve()), 6 | }; 7 | -------------------------------------------------------------------------------- /src/ice-cream/__tests__/__snapshots__/IceCreamImage.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`IceCreamImage should load and display the ice cream image 1`] = ` 4 | 8 | `; 9 | -------------------------------------------------------------------------------- /src/hooks/useUniqueIds.js: -------------------------------------------------------------------------------- 1 | import { useRef } from 'react'; 2 | import uniqid from 'uniqid'; 3 | 4 | const useUniqueIds = count => { 5 | const ids = useRef([...new Array(count)].map(() => uniqid())); 6 | return ids.current; 7 | }; 8 | 9 | export default useUniqueIds; 10 | -------------------------------------------------------------------------------- /src/ice-cream/__mocks__/IceCream.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const IceCream = ({ iceCream, onSubmit }) => ( 4 |
5 | {iceCream.name} 6 |
12 | ); 13 | -------------------------------------------------------------------------------- /src/structure/__mocks__/Main.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Main = ({ headingText, headingLevel = 2, children }) => { 4 | const H = `h${headingLevel}`; 5 | return ( 6 |
7 | {headingText} 8 | {children} 9 |
10 | ); 11 | }; 12 | 13 | export default Main; 14 | -------------------------------------------------------------------------------- /src/structure/__tests__/Footer.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import Footer from '../Footer'; 4 | 5 | describe('Footer', () => { 6 | it('should render', () => { 7 | const { container } = render(