diff --git a/src/App.js b/src/App.js
index 3784575..8f83f00 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,23 +1,13 @@
-import logo from './logo.svg';
-import './App.css';
+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 0000000..3b333cc
--- /dev/null
+++ b/src/components/ProductRow.js
@@ -0,0 +1,12 @@
+import React from "react";
+
+function ProductRow({ product }) {
+ return (
+
+ | {product.name} |
+ {product.price} |
+
+ );
+}
+
+export default ProductRow;
diff --git a/src/components/ProductTable.js b/src/components/ProductTable.js
new file mode 100644
index 0000000..7fa9bbc
--- /dev/null
+++ b/src/components/ProductTable.js
@@ -0,0 +1,27 @@
+import React from 'react'
+import './css/style.css'
+
+function ProductTable({ products }) {
+ return (
+
+
+
+ | Name |
+ Price |
+
+
+
+ {products.map((product) => (
+
+ | {product.name} |
+ {product.price} |
+
+ ))}
+
+
+ );
+}
+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 0000000..fdc3546
--- /dev/null
+++ b/src/components/ProductsPage.js
@@ -0,0 +1,50 @@
+import React, { useState } from "react";
+import SearchBar from "./SearchBar";
+import ProductTable from "./ProductTable";
+import data from "../data.json";
+import "./css/style.css";
+
+function ProductsPage() {
+ const [searchQuery, setSearchQuery] = useState("");
+ const [onlyInStock, setOnlyInStock] = useState(false);
+
+ const handleSearchChange = (query) => {
+ setSearchQuery(query);
+ };
+
+ const handleInStockChange = (event) => {
+ setOnlyInStock(event.target.checked);
+ };
+
+ const filteredProducts = data.filter((product) => {
+ const matchesSearchQuery = product.name
+ .toLowerCase()
+ .includes(searchQuery.toLowerCase());
+ const matchesStockFilter = !onlyInStock || product.inStock;
+ return matchesSearchQuery && matchesStockFilter;
+ });
+
+ return (
+
+
Search
+
+
+
+
+
+
+
+ );
+}
+
+export default ProductsPage;
diff --git a/src/components/SearchBar.js b/src/components/SearchBar.js
new file mode 100644
index 0000000..f37cf87
--- /dev/null
+++ b/src/components/SearchBar.js
@@ -0,0 +1,17 @@
+import React from 'react'
+import './css/style.css'
+
+function SearchBar({ searchQuery, onSearchChange }) {
+ return (
+
+ onSearchChange(e.target.value)}
+ />
+
+ );
+}
+
+
+export default SearchBar
\ No newline at end of file
diff --git a/src/components/css/style.css b/src/components/css/style.css
new file mode 100644
index 0000000..76d3a82
--- /dev/null
+++ b/src/components/css/style.css
@@ -0,0 +1,77 @@
+.table-wrapper {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 1500px;
+ margin-left: 0px;
+ padding-left: 200px;
+ }
+
+ table {
+ width: 100%;
+ max-width: 2000px;
+ border-collapse: collapse;
+ }
+
+ table th:first-child
+ {
+ width: 100%;
+ padding-left: 0px;
+ padding-right: -300px;
+ }
+
+ table th:nth-child(2) {
+ width: 300px;
+ margin-left: 500px;
+}
+
+ table th:first-child,
+ table th:nth-child(2)
+ {
+ background-color: rgb(209, 213, 222);
+ color: grey;
+ }
+
+ table th,
+ table td {
+ padding-top: 20px;
+ padding-bottom: 20px;
+ padding-right: 300px;
+ text-align: center;
+ }
+
+ td:first-child {
+ width: 300px;
+ padding-left: 0px;
+ }
+
+ table th:nth-child(2) {
+ width: 150px;
+ padding-right: -200px;
+ }
+
+ th:last-child,
+ .search-bar {
+ width: 100%;
+ margin-bottom: 20px;
+}
+
+.search-bar input {
+ width: 80%;
+ padding: 8px;
+ box-sizing: border-box;
+}
+
+div.search-title {
+ padding-bottom: 15px !important;
+}
+
+.in-stock-filter {
+ padding-bottom: 50px;
+}
+
+
+.out-of-stock {
+ color: red;
+
+}
\ No newline at end of file