• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    JavaScript
  • Created about 4 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Customize Project

.env vars

  • REACT_APP_AUTH_DOMAIN=
  • REACT_APP_CLIENT_ID=
  • REACT_APP_STRIPE_PUBLIC_KEY=
  • REACT_APP_STRIPE_SECRET_KEY=

Global CSS

Fonts

  • Fontshare

  • fontshare pairs

  • pick the fonts

  • purposely picked funky fonts

  • change title as well

    public/index.html

<link
  href="https://api.fontshare.com/v2/css?f[]=khand@400&f[]=array@700,400&display=swap"
  rel="stylesheet"
/>
<title>Gadget Junkie</title>

index.css

body {
  font-family: 'Khand', sans-serif;
  background: var(--clr-white);
  color: var(--clr-grey-1);
  line-height: 1.5;
  font-size: 0.875rem;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: 'Array', sans-serif;
  letter-spacing: var(--spacing);
  text-transform: capitalize;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

button {
  font-family: inherit;
}

components/Hero.js

<h1>
  We enjoy <br />
  our gadgets
</h1>

Colors

:root {
  /* INDIGO */
  /* dark shades of primary color*/
  --clr-primary-1: #312e81;
  --clr-primary-2: #3730a3;
  --clr-primary-3: #4338ca;
  --clr-primary-4: #4f46e5;
  /* primary/main color */
  --clr-primary-5: #6366f1;
  /* lighter shades of primary color */
  --clr-primary-6: #818cf8;
  --clr-primary-7: #93c5fd;
  --clr-primary-8: #bfdbfe;
  --clr-primary-9: #dbeafe;
  --clr-primary-10: #eff6ff;
  /* SLATE */
  /* darkest grey - used for headings */
  --clr-grey-1: #0f172a;
  --clr-grey-2: #1e293b;
  --clr-grey-3: #334155;
  --clr-grey-4: #475569;
  /* grey used for paragraphs */
  --clr-grey-5: #64748b;
  --clr-grey-6: #94a3b8;
  --clr-grey-7: #cbd5e1;
  --clr-grey-8: #e2e8f0;
  --clr-grey-9: #f1f5f9;
  --clr-grey-10: #f8fafc;
}

Logo

  • Figma
  • Code Version
  • create Logo.js

components/Logo

import styled from 'styled-components';
const Logo = () => {
  return (
    <Wrapper>
      <span>Gadget</span>Junkie
    </Wrapper>
  );
};

const Wrapper = styled.h3`
  margin-bottom: 0;
  color: var(--clr-grey-1);
  span {
    color: var(--clr-primary-5);
  }
`;

export default Logo;
  • replace in Navbar and Sidebar

Favicon

  • favicon.io
  • I used primary-5 color value
  • replace favicon.ico in public

Main Images - First Approach

  • get images, I usually go with pexels
  • pexels
  • replace in src/assets
  • hero-bcg.jpeg
  • hero-bcg-2.jpeg

Main Images - Second Approach

  • undraw
  • use primary color
  • hero-bcg.svg

components/Hero

<article className='img-container'>
  <img src={heroBcg} alt='nice table' className='main-img' />
</article>
gap: 2rem;

Pick Product Photos

  • at least 4 product images
  • at least 4 secondary images

Create Airtable Account

  • setup base and table
  • add products

API KEYS

  • Navigate to Docs
  • Get API_KEY and Base ID and Table Name
  • add all to .env
AIRTABLE_API_KEY=
AIRTABLE_BASE=
AIRTABLE_TABLE=

Serverless Functions

  • in functions create
  • products.js
  • single-product.js
exports.handler = async (event, context, cb) => {
  return {
    statusCode: 200,
    body: 'products route',
  };
};

Install Airtable-Node

  • already installed in main repo
npm i airtable-node

Fetch Products

functions/products

const dotenv = require('dotenv');
dotenv.config();

const Airtable = require('airtable-node');
const airtable = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY })
  .base(process.env.AIRTABLE_BASE)
  .table(process.env.AIRTABLE_TABLE);

exports.handler = async function () {
  try {
    const response = await airtable.list({ maxRecords: 200 });

    console.log('#######');
    console.log(response);
    console.log('#######');

    return {
      statusCode: 200,
      body: 'products route',
    };
  } catch (error) {
    console.log(error);
    return {
      statusCode: 500,
      body: 'There was an error',
    };
  }
};

Refactor and Return Products

exports.handler = async function () {
  try {
    const response = await airtable.list({ maxRecords: 200 });

    const products = response.records.map((product) => {
      const { id, fields } = product;
      const {
        name,
        featured,
        price,
        colors,
        company,
        description,
        category,
        shipping,
        images,
      } = fields;
      const { url } = images[0];
      return {
        id,
        name,
        featured,
        price,
        colors,
        company,
        description,
        category,
        shipping,
        image: url,
      };
    });

    return {
      statusCode: 200,
      body: JSON.stringify(products),
    };
  } catch (error) {
    console.log(error);
    return {
      statusCode: 500,
      body: 'There was an error',
    };
  }
};

Change products_url Value

utils/constants.js

export const products_url = '/.netlify/functions/products';
// export const products_url = 'https://course-api.com/react-store-products'

Fetch Single Product - Query Params

require('dotenv').config();
const Airtable = require('airtable-node');

const airtable = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY })
  .base(process.env.AIRTABLE_BASE)
  .table(process.env.AIRTABLE_TABLE);

exports.handler = async (event, context, cb) => {
  const { id } = event.queryStringParameters;
  if (id) {
    return {
      statusCode: 200,
      body: 'product',
    };
  }
  return {
    statusCode: 400,
    body: 'Please provide product id',
  };
};

Fetch Single Product

functions/single-product

require('dotenv').config();
const Airtable = require('airtable-node');

const airtable = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY })
  .base(process.env.AIRTABLE_BASE)
  .table(process.env.AIRTABLE_TABLE);

exports.handler = async (event, context, cb) => {
  const { id } = event.queryStringParameters;
  if (id) {
    try {
      let product = await airtable.retrieve(id);
      if (product.error) {
        return {
          statusCode: 404,
          body: `No product with id: ${id}`,
        };
      }
      product = { id: product.id, ...product.fields };
      return {
        statusCode: 200,
        body: JSON.stringify(product),
      };
    } catch (error) {
      return {
        statusCode: 500,
        body: `Server Error`,
      };
    }
  }
  return {
    statusCode: 400,
    body: 'Please provide product id',
  };
};

Change single_product_url Value

utils/constants.js

export const single_product_url = `/.netlify/functions/single-product?id=`;
// export const single_product_url = `https://course-api.com/react-store-single-product?id=`;

More Repositories

1

react-projects

CSS
4,790
star
2

node-express-course

JavaScript
3,513
star
3

javascript-basic-projects

CSS
3,263
star
4

react-course-v3

JavaScript
1,493
star
5

react-advanced-2020

JavaScript
893
star
6

VS-CODE-SETUP

564
star
7

redux-toolkit-tutorial

JavaScript
436
star
8

react-beach-resort-project

JavaScript
294
star
9

mern-course-jobify

JavaScript
272
star
10

react-basics-2020

JavaScript
242
star
11

react-router-6-tutorial

JavaScript
237
star
12

html-css-simply-recipes

HTML
206
star
13

typescript-course

TypeScript
187
star
14

default-starter

CSS
175
star
15

setup-files-js-comfy-house

CSS
173
star
16

javascript-nuggets

JavaScript
150
star
17

mern-jobify-v2

JavaScript
146
star
18

setup-filese-react-phone-e-commerce-project

JavaScript
143
star
19

react-phone-e-commerce-project

JavaScript
140
star
20

nextjs-course-openai

TypeScript
129
star
21

redux-toolkit-jobster

JavaScript
118
star
22

setup-files-react-beach-resort

JavaScript
106
star
23

gatsby-v3-tutorial-recipes

JavaScript
104
star
24

react-search-github-users

JavaScript
104
star
25

js-cart-setup

CSS
102
star
26

react-advanced-v18

JavaScript
101
star
27

starter-project-gatsby-strapi-portfolio-2020

CSS
96
star
28

axios-tutorial-react

JavaScript
92
star
29

vs-code-setup-2022

90
star
30

starter-project-react-github-search-users

JavaScript
83
star
31

html-css-mini-projects

CSS
75
star
32

react-course-comfy-sloth-starter

JavaScript
73
star
33

html-css-grid-project-recording

SCSS
66
star
34

react-jobs-app

JavaScript
65
star
35

gatsby-strapi-portfolio-site-2020

JavaScript
65
star
36

react-hooks-budged-calculator-app

JavaScript
63
star
37

javascript-tutorial-source-code

52
star
38

react-course-comfy-store-project-recording

JavaScript
47
star
39

html-css-comfy-store-js-course

HTML
43
star
40

gatsby-tutorial-2020

JavaScript
38
star
41

starter-project-redux-tutorial-cart

CSS
38
star
42

nextjs-course-home-away

TypeScript
38
star
43

redux-tutorial-cart

JavaScript
37
star
44

vs-code-setup-javascript-course

37
star
45

styled-components-v5

JavaScript
36
star
46

react-vite-projects-19-comfy-store-v2

JavaScript
35
star
47

react-meals-application-freeCodeCamp

JavaScript
35
star
48

gatsby-coffee-project

JavaScript
34
star
49

serverless-functions-complete-project

JavaScript
33
star
50

gatsby-v3-portfolio-project

JavaScript
32
star
51

javascript-comfy-store-course-project

CSS
31
star
52

html-css-course-v2

SCSS
29
star
53

starter-project-gatsby-v3-strapi-portfolio

CSS
28
star
54

js-course-challanges

JavaScript
28
star
55

svelte-store-project

CSS
27
star
56

javascript-challanges-series

JavaScript
26
star
57

react-node-user-workflow-front-end

JavaScript
25
star
58

js-comfy-house-parcel-setup

JavaScript
23
star
59

typescript-react-essentials

TypeScript
23
star
60

starter-project-css-grid-udemy-portfolio-project

CSS
22
star
61

react-vite-projects-18-tailwind-portfolio

JavaScript
22
star
62

react-e-commerce-v2

JavaScript
21
star
63

svelte-budget-project-recording

CSS
21
star
64

starter-project-gatsby-mdx-blog-course-project

JavaScript
21
star
65

react-nuggets

CSS
20
star
66

youtube-react-debounce

CSS
19
star
67

default-starter-latest-version

CSS
19
star
68

serverless-functions-starter

CSS
19
star
69

youtube-react-formdata-api

CSS
19
star
70

typescript-tutorial

CSS
19
star
71

javascript-oop-course-projects

CSS
18
star
72

html-css-only-floats-tea-station-project

CSS
18
star
73

nextjs-starter-kit-v1

TypeScript
17
star
74

js-comfy-house-furniture-store

JavaScript
17
star
75

html-css-mini-projects-site

CSS
17
star
76

svelte-tutorial-budget-calculator-project

CSS
16
star
77

react-projects-2-tours

CSS
16
star
78

serverless-react-all-examples-complete

JavaScript
16
star
79

react-projects-21-movie-db

CSS
16
star
80

react-vite-projects-16-contentful

CSS
16
star
81

gatsby-v3-mdx-blog-complete

JavaScript
16
star
82

html-css-tutorial-source-code

15
star
83

js-course-extra-content

JavaScript
15
star
84

html-css-nuggets

CSS
15
star
85

setup-files-gatsby-coffee

15
star
86

react-projects-23-quiz

JavaScript
15
star
87

react-vite-projects-17-cocktails

JavaScript
15
star
88

react-udemy-vintage-tech-extra-fetures

JavaScript
15
star
89

react-projects-1-birthday-reminder

CSS
15
star
90

task-manager-app

TypeScript
15
star
91

react-todo-list

JavaScript
14
star
92

starter-project-gatsby-v3-mdx-blog

JavaScript
14
star
93

html-css-slider-project

CSS
14
star
94

boot-sweets-setup

CSS
13
star
95

react-vite-projects-14-cart

JavaScript
13
star
96

react-projects-15-cocktails

JavaScript
13
star
97

svelte-store-server

HTML
13
star
98

react-vite-projects-2-tours

CSS
13
star
99

setup-files-react-budget-calculator

CSS
13
star
100

react-person-list-project

JavaScript
13
star