A small React + TypeScript single page app (SPA) showcasing phones, tablets and accessories with cart and favorites support.
- Modern frontend demo built with Vite, React 18 and TypeScript.
- Uses CSS Modules + SCSS for styling, local JSON files in
public/apias a simple data source, and local images underpublic/img/img.
- React 18 + TypeScript
- React Router v6
- Redux (Redux Toolkit)
- CSS Modules + SCSS
- Vite (dev server / build)
- Home page with hero slider and product carousels
- Category pages: phones, tablets, accessories (sorting, pagination, URL-persisted params)
- Product detail pages with gallery, configurator and specs
- Cart with quantity controls and localStorage persistence
- Favorites (toggle hearts) persisted in localStorage
- Light / Dark theme toggle and responsive layout
Top-level important folders:
public/
├─ api/ # JSON product feeds used by the app
└─ img/ # product and icon images
src/
├─ app/ # layout, providers, router
├─ features/ # app features (cart, favorites, product, home)
├─ pages/ # top-level pages
├─ shared/ # shared components, services
└─ styles/ # global styles and variables
Components generally follow the pattern: ComponentName/ with index.ts, ComponentName.tsx, and ComponentName.module.scss.
Prerequisites:
- Node.js 18+ (or current LTS)
- npm (or yarn)
Install dependencies and start dev server:
npm install
npm startBy default Vite serves on http://localhost:5173. Open the URL shown by the dev server.
npm start— start Vite dev servernpm run build— production buildnpm run lint— run ESLint
This project reads static JSON files from public/api (for example public/api/products.json, phones.json, etc.). In development the Vite dev server serves those files at /api/<file>.json out of the public folder, so components can fetch them with a relative URL such as /api/phones.json.
If you need to mock additional endpoints, add JSON files to public/api.
- Image assets are stored under
public/imgandimg/in the workspace — keep filenames stable when updating components. - Application state:
store/store.tsand slices instore/slices/(Redux Toolkit). - Theme handling uses
src/app/providers/ThemeContext.tsxand CSS variables insrc/styles. - Routing lives in
src/routes/AppRouter.tsxand route paths insrc/routes/RoutePaths.ts.
No test runner is included by default. ESLint can be run with:
npm run lint