-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ig 13
- Loading branch information
Showing
15 changed files
with
278 additions
and
363 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './MainPage/MainPage' | ||
export * from './mainPage/MainPage' | ||
export * from './productsPage/ProductsPage' |
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,12 @@ | ||
export const MainPage = () => { | ||
return ( | ||
<main> | ||
<h1>Shop Main Page</h1> | ||
{/* <Carousel> | ||
<div>TEST 1</div> | ||
<div>TEST 2</div> | ||
<div>TEST 3</div> | ||
</Carousel> */} | ||
</main> | ||
); | ||
}; |
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,71 @@ | ||
import React, { useState } from 'react'; | ||
import { Product } from '../../../interfaces'; | ||
import { ProductItem, SearchInput } from '../../shared'; | ||
import './style.css'; | ||
|
||
const products: Product[] = [ | ||
{ | ||
_id: 'test', | ||
name: 'Adidas 2000', | ||
description: 'Some description', | ||
price: 100, | ||
size: 'x1', | ||
img: 'https://www.eobuwie.com.pl/media/catalog/product/cache/image/650x650/0/0/0000201282847_01_fp.jpg', | ||
productType: '', | ||
productCategory: '', | ||
brand: '', | ||
}, | ||
{ | ||
_id: 'test2', | ||
name: 'Adidas', | ||
description: 'Some description 5e00', | ||
price: 125, | ||
size: 'l', | ||
img: 'https://www.eobuwie.com.pl/media/catalog/product/cache/image/650x650/0/0/0000206708137_1__1.jpg', | ||
productType: '', | ||
productCategory: '', | ||
brand: '', | ||
}, | ||
{ | ||
_id: 'test3', | ||
name: 'Adidas Turbo', | ||
description: 'Some description 777', | ||
price: 185, | ||
size: 'l', | ||
img: 'https://www.eobuwie.com.pl/media/catalog/product/cache/image/650x650/0/0/0000209204049_01_rz.jpg', | ||
productType: '', | ||
productCategory: '', | ||
brand: '', | ||
}, | ||
]; | ||
|
||
interface productsPageProps { | ||
header: string; | ||
} | ||
|
||
export const ProductsPage = ({ header }: productsPageProps): JSX.Element => { | ||
const [filteredProducts, setFilteredProducts] = useState<Product[]>(products); | ||
|
||
const searchProduct = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
const { value } = e.target; | ||
const results: Product[] = products.filter( | ||
(product) => | ||
product.name.toLowerCase().includes(value.toLowerCase()) || | ||
product.description.toLowerCase().includes(value.toLowerCase()) | ||
); | ||
|
||
setFilteredProducts(results); | ||
}; | ||
|
||
return ( | ||
<div className="products__page"> | ||
<h2 className="products__page__title">{header}</h2> | ||
<SearchInput onSearch={searchProduct} /> | ||
<div className="products__page__items"> | ||
{filteredProducts.map((item) => { | ||
return <ProductItem key={item._id} {...item} />; | ||
})} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
.products__page__title{ | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 30px; | ||
margin-bottom: 30px; | ||
} | ||
|
||
.products__page__items{ | ||
display: flex; | ||
flex-wrap: wrap; | ||
|
||
} |
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,18 @@ | ||
import React from 'react'; | ||
|
||
interface props { | ||
onSearch: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
export const SearchInput = ({ onSearch }: props): JSX.Element => { | ||
return ( | ||
<div className="products__search"> | ||
<input | ||
type="text" | ||
onChange={onSearch} | ||
className="products__search__input" | ||
placeholder="Search..." | ||
></input> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './api'; | ||
export * from './notification' | ||
export * from './notification' | ||
export * from './product' |
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,11 @@ | ||
export type Product = { | ||
_id: string; | ||
name: string; | ||
description: string; | ||
price: number; | ||
size: string; | ||
img: string; | ||
productType?: string; | ||
productCategory?: string; | ||
brand?: string; | ||
}; |
Oops, something went wrong.