├── demo.jpg ├── public ├── favicon.ico └── index.html ├── src ├── assets │ ├── about_img.jpg │ └── hero_img.png ├── pages │ ├── HomePage.js │ ├── CheckoutPage.js │ ├── ProductsPage.js │ ├── ErrorPage.js │ ├── AboutPage.js │ ├── CartPage.js │ └── SingleProductPage.js ├── components │ ├── Error.js │ ├── share │ │ ├── Typography.js │ │ ├── Button.js │ │ └── Icons.js │ ├── Stars.js │ ├── Footer.js │ ├── PopularProducts.js │ ├── EmptyCart.js │ ├── Loading.js │ ├── Products.js │ ├── Breadcrumb.js │ ├── AddToCart.js │ ├── AmountButtons.js │ ├── index.js │ ├── Services.js │ ├── Hero.js │ ├── GridProducts.js │ ├── Contact.js │ ├── CartButtons.js │ ├── ListProducts.js │ ├── CartTotals.js │ ├── CartItem.js │ ├── Navbar.js │ ├── Sidebar.js │ ├── Sort.js │ └── Filters.js ├── utils │ ├── helpers.js │ ├── constants.js │ └── actions.js ├── index.js ├── App.js ├── styles │ ├── Screen.js │ └── GlobalStyle.js ├── routes │ └── ConfigRoutes.js ├── reducers │ ├── products_reducer.js │ ├── cart_reducer.js │ └── filter_reducer.js └── contexts │ ├── cart_context.js │ ├── products_context.js │ └── filter_context.js ├── .gitignore ├── README.md └── package.json /demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamalheydari/react-store-fake-api/HEAD/demo.jpg -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamalheydari/react-store-fake-api/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/about_img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamalheydari/react-store-fake-api/HEAD/src/assets/about_img.jpg -------------------------------------------------------------------------------- /src/assets/hero_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamalheydari/react-store-fake-api/HEAD/src/assets/hero_img.png -------------------------------------------------------------------------------- /src/pages/HomePage.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | 4 | import { PopularProducts, Services, Hero, Contact } from "../components"; 5 | 6 | const HomePage = () => { 7 | 8 | 9 | return ( 10 |
11 | 12 | 13 | 14 | 15 |
16 | ); 17 | }; 18 | 19 | export default HomePage; 20 | -------------------------------------------------------------------------------- /.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/Error.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import styled from "styled-components"; 3 | 4 | import { Typography } from "."; 5 | 6 | const Error = () => { 7 | return ( 8 | 9 | there was an error 10 | 11 | ); 12 | }; 13 | 14 | const Wrapper = styled.div` 15 | padding: 10rem; 16 | display: flex; 17 | align-items: center; 18 | justify-content: center; 19 | color: var(--red-color-1); 20 | `; 21 | export default Error; 22 | -------------------------------------------------------------------------------- /src/utils/helpers.js: -------------------------------------------------------------------------------- 1 | export const truncate = (str = "", len) => { 2 | if (str.length > len && str.length > 0) { 3 | let new_str = str + " "; 4 | new_str = str.substr(0, len); 5 | new_str = str.substr(0, new_str.lastIndexOf(" ")); 6 | new_str = new_str.length > 0 ? new_str : str.substr(0, len); 7 | return new_str + "..."; 8 | } 9 | return str; 10 | }; 11 | 12 | export const getUniqueValues = (data, type) => { 13 | let unique = data.map((item) => item[type]); 14 | return ["all", ...new Set(unique)]; 15 | }; 16 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | 5 | //? Contexts 6 | import { ProductsProvider } from "./contexts/products_context"; 7 | import { FilterProvider } from "./contexts/filter_context"; 8 | import { CartProvider } from "./contexts/cart_context"; 9 | 10 | 11 | ReactDOM.render( 12 | 13 | 14 | 15 | 16 | 17 | 18 | , 19 | document.getElementById("root") 20 | ); 21 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { HashRouter as Router } from "react-router-dom"; 3 | 4 | //? Components 5 | import { Navbar, Sidebar, Footer } from "./components"; 6 | import ConfigRoutes from "./routes/ConfigRoutes"; 7 | 8 | //? Global Style 9 | import GlobalStyle from "./styles/GlobalStyle"; 10 | 11 | const App = () => { 12 | return ( 13 | <> 14 | 15 | 16 | 17 | 18 | 19 |