Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop #496

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22,056 changes: 14,410 additions & 7,646 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"dependencies": {
"@cypress/react18": "^2.0.0",
"@fortawesome/fontawesome-free": "^6.2.0",
"@reduxjs/toolkit": "^2.2.7",
"@types/react-transition-group": "^4.4.5",
"bulma": "^0.9.4",
"classnames": "^2.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^9.1.2",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"react-transition-group": "^4.4.5"
Expand All @@ -37,7 +39,7 @@
"prettier": "^3.2.5",
"sass": "^1.72.0",
"stylelint": "^15.11.0",
"typescript": "5.1.6"
"typescript": "^4.9.5"
},
"scripts": {
"start": "mate-scripts start -l",
Expand Down
25 changes: 25 additions & 0 deletions public/img/header/Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/img/homePage/Banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions public/img/homePage/category/Accessories.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions public/img/homePage/category/Phones.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions public/img/homePage/category/Tablets.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/homePage/foto-2-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/homePage/iphone11watersplash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/homePage/iphone12-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Chevron-left-dis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Chevron-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Chevron-right-dis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Chevron-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Chevron_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/FavouritesFilledHeart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/img/icons/Home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/img/icons/Menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Minus-dis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/Plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/img/icons/bucket_header.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/img/icons/favourites.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Phone catalog</title>
<link rel="icon" type="image/x-icon" href="./img/icons/Home.svg">
</head>
<body>
<div id="root"></div>
Expand Down
42 changes: 41 additions & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
// not empty
/* Define the custom fonts using @font-face */
@font-face {
font-family: 'Mont-Bold';
src: url('../public/fonts/Mont-Bold.otf') format('opentype');
}

@font-face {
font-family: 'Mont-Regular';
src: url('../public/fonts/Mont-Regular.otf') format('opentype');
}

/* Global styles */
html {
scroll-behavior: smooth;
}

body {
margin: 0;
padding: 0;
}

.header {
background-color: #fff;
position: sticky; top: 0;
z-index: 1;
}

/* Main content area */
.main {
min-height: calc(100vh - 170px);
}

/* Heading styles */
h1, h2, h3, h4, li {
font-family: 'Mont-Bold', sans-serif;
}

/* Paragraph styles */
p {
font-family: 'Mont-Regular', sans-serif;
}
58 changes: 53 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,55 @@
import { Navigate, Route, Routes } from 'react-router-dom';
import './App.scss';
import { HomePage } from './components/HomePage/HomePage';
import { Header } from './components/Header';
import { Footer } from './components/Footer';
import { getProductsAsync } from './features/getProductsSlice';
import { useEffect } from 'react';
import { useAppDispatch } from './app/hooks';
import { FavouritesPage } from './components/FavouritesPage';
import { GeneralProductsPage } from './components/GeneralProductPage';
import { ItemInformation } from './components/ItemInformation';
import { BucketPage } from './components/BucketPage';

export const App = () => (
<div className="App">
<h1>Product Catalog</h1>
</div>
);
export const App = () => {
const dispatch = useAppDispatch();

useEffect(() => {
dispatch(getProductsAsync());
}, [dispatch]);

return (
<>
<div className="App">
<div className="page-content">
<header className="header">
<Header />
</header>

<main className="main">
<Routes>
<Route path="/">
<Route index element={<HomePage />} />
{/* <Route path=":productId?" element={<ItemInformation />} /> */}
</Route>
<Route path="home" element={<Navigate to="/" replace={true} />} />
<Route path=":category">
<Route index element={<GeneralProductsPage />} />
<Route path=":productId?" element={<ItemInformation />} />
</Route>

<Route path="favourites" element={<FavouritesPage />} />
<Route path="bucket" element={<BucketPage />} />

<Route path="*" element={<p>Page not found</p>} />
</Routes>
</main>

<footer className="footer">
<Footer />
</footer>
</div>
</div>
</>
);
};
5 changes: 5 additions & 0 deletions src/app/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
import { AppDispatch, RootState } from './store';

export const useAppDispatch = () => useDispatch<AppDispatch>();
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
30 changes: 30 additions & 0 deletions src/app/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit';
import getProductsSlice from '../features/getProductsSlice';
import getAllProductsReducer from '../features/getAllProductsSlice';
import getTabletsSlice from '../features/getTabletsSlice';
import getAccessoriesSlice from '../features/getAccessoriesSlice';
import addFavouritesSlice from '../features/addFavouritesSlice';
import addBucketInfoSlice from '../features/addBucketInfoSlice';

export const store = configureStore({
reducer: {
products: getProductsSlice,
allProducts: getAllProductsReducer,
tablets: getTabletsSlice,
accessories: getAccessoriesSlice,
addedFavourites: addFavouritesSlice,
addedBucket: addBucketInfoSlice,
},
});

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;

/* eslint-disable @typescript-eslint/indent */
export type AppThunk<ReturnType = void> = ThunkAction<
ReturnType,
RootState,
unknown,
Action<string>
>;
/* eslint-enable @typescript-eslint/indent */
Loading