diff --git a/src/App.css b/src/App.css
index 74b5e0534..3734058a8 100644
--- a/src/App.css
+++ b/src/App.css
@@ -1,38 +1,24 @@
-.App {
- text-align: center;
-}
-
-.App-logo {
- height: 40vmin;
- pointer-events: none;
-}
-
-@media (prefers-reduced-motion: no-preference) {
- .App-logo {
- animation: App-logo-spin infinite 20s linear;
- }
-}
-
-.App-header {
- background-color: #282c34;
- min-height: 100vh;
+.App{
display: flex;
- flex-direction: column;
align-items: center;
justify-content: center;
- font-size: calc(10px + 2vmin);
- color: white;
}
-.App-link {
- color: #61dafb;
+.ProductTable{
+ width: 500px;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+
}
-@keyframes App-logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
+thead,tr,th,td{
+ text-align: center;
+ padding: 10px;
+ width: 50%;
+ border: 1px solid black;
}
+
+thead{
+ background-color: gray;
+}
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index 378457572..0c22d10aa 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,22 +1,11 @@
-import logo from './logo.svg';
import './App.css';
+import ProductsPage from "./components/ProductsPage";
function App() {
return (
);
diff --git a/src/components/ProductRow.js b/src/components/ProductRow.js
new file mode 100644
index 000000000..a16183070
--- /dev/null
+++ b/src/components/ProductRow.js
@@ -0,0 +1,10 @@
+function ProductRow({product}) {
+ return <>
+
+ | {product.name} |
+ {product.price} |
+
+ >
+}
+
+export default ProductRow;
\ No newline at end of file
diff --git a/src/components/ProductTable.js b/src/components/ProductTable.js
new file mode 100644
index 000000000..4c132d93f
--- /dev/null
+++ b/src/components/ProductTable.js
@@ -0,0 +1,20 @@
+import ProductRow from "./ProductRow";
+
+function ProductTable({products, searchValue, onlyShowInStock}) {
+ return
+
+
+ | Name |
+ Price |
+
+
+ {products
+ .filter((product)=>product.name.toLowerCase().includes(searchValue.toLowerCase()))
+ .filter((product)=>onlyShowInStock ? product.inStock : true )
+ .map((product)=> )}
+
+
+
+}
+
+export default ProductTable;
\ No newline at end of file
diff --git a/src/components/ProductsPage.js b/src/components/ProductsPage.js
new file mode 100644
index 000000000..daae083f2
--- /dev/null
+++ b/src/components/ProductsPage.js
@@ -0,0 +1,16 @@
+import SearchBar from "./SearchBar";
+import ProductTable from "./ProductTable";
+import products from "../data.json"
+import { useState } from "react";
+
+function ProductsPage() {
+ const [searchValue, setSearchValue] = useState("");
+ const [onlyShowInStock, setOnlyShowInStock] = useState(false);
+
+ return
+}
+
+export default ProductsPage;
\ No newline at end of file
diff --git a/src/components/SearchBar.js b/src/components/SearchBar.js
new file mode 100644
index 000000000..af8b42798
--- /dev/null
+++ b/src/components/SearchBar.js
@@ -0,0 +1,14 @@
+function SearchBar({searchValue, setSearchValue, onlyShowInStock, setOnlyShowInStock}) {
+ const searchValueHandler=(e)=>{setSearchValue(e.target.value)};
+ const checkboxValueHandler=()=>{setOnlyShowInStock(!onlyShowInStock)};
+
+ return
+
+
+
+
+
+
+}
+
+export default SearchBar;
\ No newline at end of file