forked from MastersAcademy/fe-react-2024
-
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.
- Loading branch information
Kostya Nosatskyi
authored and
Kostya Nosatskyi
committed
Jun 8, 2024
1 parent
693c22c
commit c1be127
Showing
19 changed files
with
750 additions
and
407 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useState } from 'react'; | ||
import { Outlet } from 'react-router-dom'; | ||
|
||
import { clsx } from 'clsx'; | ||
|
||
import { FooterComponent } from '@/components/footer/Footer.component.tsx'; | ||
import { HeaderComponent } from '@/components/header/Header.component.tsx'; | ||
|
||
export const LayoutPage = () => { | ||
const [theme, setTheme] = useState('light'); | ||
const themeClass = clsx(`${theme}Theme`); | ||
|
||
return ( | ||
<div className={themeClass}> | ||
<HeaderComponent changeTheme={setTheme} activeTheme={theme} /> | ||
<Outlet /> | ||
<FooterComponent /> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Link } from 'react-router-dom'; | ||
|
||
import styles from './pageNotFound.module.css'; | ||
|
||
export const PageNotFound = () => ( | ||
<section className={styles.errorText}> | ||
<h2>Oops!</h2> | ||
<h3>404 - page not found!</h3> | ||
<span>Maybe we are just working on this page, or maybe it doesn't exist at all...( </span> | ||
<span>let's start all over shall we? </span> | ||
<Link className={styles.backButton} to={'/'}> | ||
start all over again | ||
</Link> | ||
</section> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.errorText, .backButton { | ||
font-family: inherit; | ||
} | ||
|
||
.errorText { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
height: 70vh; | ||
margin: auto 20px; | ||
text-align: center; | ||
} | ||
|
||
.backButton { | ||
padding: 10px 20px; | ||
margin-top: 30px; | ||
border: 1px solid var(--color-border-button); | ||
border-radius: 8px; | ||
text-decoration: none; | ||
color: var(--txt-secondary); | ||
} | ||
|
||
.backButton:hover { | ||
background-color: var(--background-button); | ||
color: var(--bg-primary); | ||
} |
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,17 +1,23 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { Cart } from '@/components/cart/Cart.component.tsx'; | ||
import type { Product } from '@/interface/interfaceProductCategory.ts'; | ||
|
||
import styles from './productCard.module.css'; | ||
|
||
export const ProductCard: React.FC<{ product: Product }> = ({ product }) => ( | ||
<div className={styles.card}> | ||
<img className={styles.cardImage} src={product.images} alt="Product" /> | ||
<h2 className={styles.cardTitle}>{product.title}</h2> | ||
<div className={styles.cardBuy}> | ||
<span className={styles.cardPrice}>{product.price} </span> | ||
<Cart /> | ||
export const ProductCard: React.FC<{ product: Product }> = ({ product }) => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<div className={styles.card}> | ||
<img className={styles.cardImage} src={product.images[0]} alt="Product" /> | ||
<button className={styles.cardButton} onClick={() => navigate(`/product_page/${product.id}`)}> | ||
<h2 className={styles.cardTitle}>{product.title}</h2> | ||
</button> | ||
<div className={styles.cardBuy}> | ||
<span className={styles.cardPrice}>{product.price} </span> | ||
<Cart /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
); | ||
}; |
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
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.