-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fixCardLink
- Loading branch information
Showing
40 changed files
with
1,893 additions
and
1,494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
// Utils | ||
@import './styles/utils/reset'; | ||
@import './styles/utils/normalize'; | ||
@import './styles/utils/typography'; | ||
|
||
// Blocks | ||
@import './styles/blocks/page'; | ||
@import './styles/blocks/grid'; | ||
@import './styles/blocks/container'; | ||
|
||
:root { | ||
font-family: 'Mont', sans-serif; | ||
scroll-behavior: smooth; | ||
} | ||
|
||
// Utils | ||
@import './styles/utils/reset'; | ||
@import './styles/utils/normalize'; | ||
@import './styles/utils/typography'; | ||
|
||
// Blocks | ||
@import './styles/blocks/page'; | ||
@import './styles/blocks/grid'; | ||
@import './styles/blocks/container'; | ||
|
||
:root { | ||
font-family: 'Mont', sans-serif; | ||
scroll-behavior: smooth; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,116 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { | ||
Navigate, | ||
Route, | ||
HashRouter as Router, | ||
Routes, | ||
} from 'react-router-dom'; | ||
import { App } from './App'; | ||
import { HomePage } from './modules/HomePage'; | ||
import { HomePage } from './modules/HomePage/HomePage'; | ||
import { ProductsPage } from './modules/PhonesPage'; | ||
import { ProductDetailsPage } from './modules/ProductDetailsPage'; | ||
import { CartPage } from './modules/CartPage'; | ||
import { NotFoundPage } from './modules/NotFoundPage'; | ||
import { PageInProgress } from './modules/PageInProgress'; | ||
import { FavoritesPage } from './modules/FavoritesPage'; | ||
import { | ||
getProductsWithSearchParams as loadPhones, | ||
getProductAmount as loadPhonesAmount, | ||
getProductDetail, | ||
getProductAmount, | ||
getProductsWithSearchParams, | ||
} from './api/service'; | ||
import { Categories, EndPoints, ProductsAmount } from './types/Enums'; | ||
|
||
const MOBILE_TITLE = 'Mobile phones'; | ||
// const TABLETS_TITLE = 'Tablet'; | ||
// const ACCESSOTIES_TITLE = 'Accessories'; | ||
const TABLETS_TITLE = 'Tablet'; | ||
const ACCESSORIES_TITLE = 'Accessories'; | ||
|
||
export const Root = () => ( | ||
<Router> | ||
<Routes> | ||
<Route> | ||
<Route path="/" element={<App />}> | ||
<Route index element={<HomePage />} /> | ||
<Route path="home" element={<Navigate to="/" replace />} /> | ||
<Route path="phones"> | ||
<Route | ||
index | ||
element={( | ||
<ProductsPage | ||
title={MOBILE_TITLE} | ||
loadData={loadPhones} | ||
loadAmount={loadPhonesAmount} | ||
/> | ||
)} | ||
/> | ||
<Route path=":phoneId?" element={<ProductDetailsPage />} /> | ||
</Route> | ||
{/* <Route | ||
path="tablets" | ||
element={ | ||
export const Root = () => { | ||
const [amounts, setAmounts] = useState<ProductsAmount>(); | ||
|
||
useEffect(() => { | ||
getProductAmount(Categories.All).then(setAmounts); | ||
}, []); | ||
|
||
return ( | ||
<Router> | ||
<Routes> | ||
<Route> | ||
<Route path="/" element={<App />}> | ||
<Route index element={<HomePage />} /> | ||
<Route path="home" element={<Navigate to="/" replace />} /> | ||
<Route path={Categories.Phones}> | ||
<Route | ||
index | ||
element={( | ||
<ProductsPage | ||
title={MOBILE_TITLE} | ||
loadData={getProductsWithSearchParams} | ||
productAmount={amounts?.phones} | ||
endpoint={EndPoints.Phones} | ||
/> | ||
)} | ||
/> | ||
<Route | ||
path=":itemId?" | ||
element={( | ||
<ProductDetailsPage | ||
loadData={getProductDetail} | ||
endPoint={EndPoints.Phones} | ||
/> | ||
)} | ||
/> | ||
</Route> | ||
<Route path={Categories.Tablets}> | ||
<Route | ||
index | ||
element={( | ||
<ProductsPage | ||
title={TABLETS_TITLE} | ||
loadData={loadPhones} | ||
loadAmount={loadPhonesAmount} | ||
/>} | ||
/> */} | ||
{/* <Route | ||
path="accessories" | ||
element={ | ||
loadData={getProductsWithSearchParams} | ||
productAmount={amounts?.tablets} | ||
endpoint={EndPoints.Tablets} | ||
/> | ||
)} | ||
/> | ||
<Route | ||
path=":itemId?" | ||
element={( | ||
<ProductDetailsPage | ||
loadData={getProductDetail} | ||
endPoint={EndPoints.Tablets} | ||
/> | ||
)} | ||
/> | ||
</Route> | ||
<Route path={Categories.Accessories}> | ||
<Route | ||
index | ||
element={( | ||
<ProductsPage | ||
title={ACCESSOTIES_TITLE} | ||
loadData={loadPhones} | ||
loadAmount={loadPhonesAmount} | ||
/>} | ||
/> */} | ||
<Route path="favorites" element={<FavoritesPage />} /> | ||
<Route path="cart" element={<CartPage />} /> | ||
<Route path="pageInProgress" element={<PageInProgress />} /> | ||
<Route path="*" element={<NotFoundPage />} /> | ||
title={ACCESSORIES_TITLE} | ||
loadData={getProductsWithSearchParams} | ||
productAmount={amounts?.accessories} | ||
endpoint={EndPoints.Accessories} | ||
/> | ||
)} | ||
/> | ||
<Route | ||
path=":itemId?" | ||
element={( | ||
<ProductDetailsPage | ||
loadData={getProductDetail} | ||
endPoint={EndPoints.Accessories} | ||
/> | ||
)} | ||
/> | ||
</Route> | ||
<Route path="favorites" element={<FavoritesPage />} /> | ||
<Route path="cart" element={<CartPage />} /> | ||
<Route path="pageInProgress" element={<PageInProgress />} /> | ||
<Route path="*" element={<NotFoundPage />} /> | ||
</Route> | ||
</Route> | ||
</Route> | ||
</Routes> | ||
</Router> | ||
); | ||
</Routes> | ||
</Router> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.