Skip to content

Mary2021/e-commerce-product-page

Repository files navigation

Frontend Mentor - E-commerce product page solution

This is a solution to the E-commerce product page challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the site depending on their device's screen size
  • Switch the large product image by clicking on the small thumbnail images
  • Users can see hover states for all interactive elements on the page
  • Open a lightbox gallery by clicking on the large product image (needs to be added)
  • Add items to the cart
  • View the cart and remove items from it

Screenshot

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Mobile-first workflow
  • React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. https://vitejs.dev/guide/

React-bootstrap

npm install react-bootstrap bootstrap

Yet Another React Lightbox

npm install yet-another-react-lightbox

Redux

Testing

Vitest and React Testing Library

  • npm install --save-dev vitest
  • add script => "test": "vitest"
  • npm install --save-dev jsdom
  • npm install --save-dev @testing-library/jest-dom @testing-library/react @testing-library/user-event
  • add to vite.config =>
test: {
  //add jsdom to vite
  environment: 'jsdom',
  //make all imports from Vitest global so that we don’t manually import in each test file
  globals: true,
  //include this setup test file
  setupFiles: './src/tests/setup.jsx', // assuming the test folder is in the src of our project
}

Web-vitals

Install web-vitals

Useful links

Author