From 8e3754ef304eb471fff932c4b38016dbbbdc3f5d Mon Sep 17 00:00:00 2001
From: VijayaAdamane <95336658+VijayaAdamane@users.noreply.github.com>
Date: Sun, 18 Feb 2024 09:24:33 +0530
Subject: [PATCH 1/4] Create ProductRow.css
---
components/ProductRow.css | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 components/ProductRow.css
diff --git a/components/ProductRow.css b/components/ProductRow.css
new file mode 100644
index 0000000..1a50a33
--- /dev/null
+++ b/components/ProductRow.css
@@ -0,0 +1,21 @@
+.productRow {
+ display: flex;
+ flex-flow: row nowrap;
+ justify-content: space-around;
+
+ border: none;
+
+ background-color: white;
+
+ font-size: 20px;
+
+ margin: 5px;
+}
+
+.available {
+ color: rgb(7, 7, 59);
+}
+
+.soldOut {
+ color: red;
+}
From 51b3bec3081f51e39529957fcdfd46d5cac04504 Mon Sep 17 00:00:00 2001
From: VijayaAdamane <95336658+VijayaAdamane@users.noreply.github.com>
Date: Sun, 18 Feb 2024 09:28:56 +0530
Subject: [PATCH 2/4] Delete components directory
---
components/ProductRow.css | 21 ---------------------
1 file changed, 21 deletions(-)
delete mode 100644 components/ProductRow.css
diff --git a/components/ProductRow.css b/components/ProductRow.css
deleted file mode 100644
index 1a50a33..0000000
--- a/components/ProductRow.css
+++ /dev/null
@@ -1,21 +0,0 @@
-.productRow {
- display: flex;
- flex-flow: row nowrap;
- justify-content: space-around;
-
- border: none;
-
- background-color: white;
-
- font-size: 20px;
-
- margin: 5px;
-}
-
-.available {
- color: rgb(7, 7, 59);
-}
-
-.soldOut {
- color: red;
-}
From 3ac07aab309d2acca71e85cca608987fd6bcfa4f Mon Sep 17 00:00:00 2001
From: VijayaAdamane <95336658+VijayaAdamane@users.noreply.github.com>
Date: Sun, 18 Feb 2024 09:30:29 +0530
Subject: [PATCH 3/4] Create ProductRow.css
---
src/components/ProductRow.css | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 src/components/ProductRow.css
diff --git a/src/components/ProductRow.css b/src/components/ProductRow.css
new file mode 100644
index 0000000..1a50a33
--- /dev/null
+++ b/src/components/ProductRow.css
@@ -0,0 +1,21 @@
+.productRow {
+ display: flex;
+ flex-flow: row nowrap;
+ justify-content: space-around;
+
+ border: none;
+
+ background-color: white;
+
+ font-size: 20px;
+
+ margin: 5px;
+}
+
+.available {
+ color: rgb(7, 7, 59);
+}
+
+.soldOut {
+ color: red;
+}
From d77a129bf3952c65c98f4793a1146192a984211c Mon Sep 17 00:00:00 2001
From: VijayaAdamane <95336658+VijayaAdamane@users.noreply.github.com>
Date: Sun, 18 Feb 2024 09:31:00 +0530
Subject: [PATCH 4/4] Add files via upload
---
src/components/ProductRow.js | 15 ++++++++++++
src/components/ProductsPage.css | 5 ++++
src/components/ProductsPage.js | 33 ++++++++++++++++++++++++++
src/components/ProductsTable.css | 37 +++++++++++++++++++++++++++++
src/components/ProductsTable.js | 34 +++++++++++++++++++++++++++
src/components/SearchBar.css | 40 ++++++++++++++++++++++++++++++++
src/components/SearchBar.js | 26 +++++++++++++++++++++
7 files changed, 190 insertions(+)
create mode 100644 src/components/ProductRow.js
create mode 100644 src/components/ProductsPage.css
create mode 100644 src/components/ProductsPage.js
create mode 100644 src/components/ProductsTable.css
create mode 100644 src/components/ProductsTable.js
create mode 100644 src/components/SearchBar.css
create mode 100644 src/components/SearchBar.js
diff --git a/src/components/ProductRow.js b/src/components/ProductRow.js
new file mode 100644
index 0000000..cdd86fb
--- /dev/null
+++ b/src/components/ProductRow.js
@@ -0,0 +1,15 @@
+import './ProductRow.css';
+
+import React from 'react'
+
+export default function ProductRow(props) {
+
+ const inStock = props.inStock;
+
+ return (
+
+ | {props.name} |
+ {props.price} |
+
+ )
+}
diff --git a/src/components/ProductsPage.css b/src/components/ProductsPage.css
new file mode 100644
index 0000000..a76f274
--- /dev/null
+++ b/src/components/ProductsPage.css
@@ -0,0 +1,5 @@
+.title {
+ font-size: 50px;
+ font-family: Georgia, 'Times New Roman', Times, serif;
+ color: rgb(231, 54, 15)
+}
\ No newline at end of file
diff --git a/src/components/ProductsPage.js b/src/components/ProductsPage.js
new file mode 100644
index 0000000..29fc012
--- /dev/null
+++ b/src/components/ProductsPage.js
@@ -0,0 +1,33 @@
+import { useState } from 'react';
+
+import jsonData from './../data.json';
+
+import './ProductsPage.css';
+
+import SearchBar from './SearchBar';
+import ProductsTable from './ProductsTable';
+
+
+
+export default function ProductsPage() {
+
+ const [products, setProducts] = useState(jsonData);
+ const [searchString, setSearchString] = useState('');
+ const [isChecked, setIsChecked] = useState(false);
+
+ function onSearchChange(newSearchString) {
+ setSearchString(newSearchString);
+ }
+
+ function onCheck() {
+ setIsChecked(isChecked ? false : true);
+ }
+
+ return (
+
+ )
+}
diff --git a/src/components/ProductsTable.css b/src/components/ProductsTable.css
new file mode 100644
index 0000000..e06cd16
--- /dev/null
+++ b/src/components/ProductsTable.css
@@ -0,0 +1,37 @@
+.productsTable {
+ display: flex;
+ flex-flow: column nowrap;
+ justify-content: space-around;
+
+ border: none;
+
+ margin: 20px;
+}
+
+.tableHeader {
+ display: flex;
+ flex-flow: row nowrap;
+
+ font-size: 30px;
+ color: white;
+
+ background-color: rgb(212, 86, 40);
+}
+
+.rowContainer {
+ background-color: rgb(212, 212, 235);
+}
+
+.productInfo {
+ margin: 5px;
+ padding: 5px;
+
+ margin-left: 275px;
+}
+
+.productPrice {
+ margin-left: 0px;
+ padding-left: 0px;
+
+ margin-left: 600px;
+}
\ No newline at end of file
diff --git a/src/components/ProductsTable.js b/src/components/ProductsTable.js
new file mode 100644
index 0000000..be8cf92
--- /dev/null
+++ b/src/components/ProductsTable.js
@@ -0,0 +1,34 @@
+import './ProductsTable.css';
+
+import React from 'react';
+
+import ProductRow from './ProductRow';
+
+export default function ProductsTable(props) {
+ const products = props.data;
+ const searchString = props.searchString.toLowerCase();
+
+ let filteredProducts = products.filter((product) => {
+ return product.name.toLowerCase().startsWith(searchString);
+ });
+
+ // let inStockProducts = [];
+ if (props.isChecked) {
+ filteredProducts = filteredProducts.filter((product) => product.inStock)
+ }
+
+
+ return (
+
+
+
+ | Product Name |
+ Price |
+
+
+
+ {filteredProducts.map((product) =>
)}
+
+
+ )
+}
diff --git a/src/components/SearchBar.css b/src/components/SearchBar.css
new file mode 100644
index 0000000..5bde476
--- /dev/null
+++ b/src/components/SearchBar.css
@@ -0,0 +1,40 @@
+.searchBox {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ margin: 20px;
+
+ border: none;
+
+ background-color: rgb(200, 200, 224);
+}
+
+.searchHeading {
+ color: rgb(33, 33, 59);
+ font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
+ font-size: 35px;
+
+ margin: 10px;
+ margin-bottom: 5px;
+}
+
+.inputField {
+ width: 500px;
+ height: 30px;
+
+ font-size: 25px;
+
+ border: none;
+
+ margin: 10px;
+ margin-top: 0px;
+ margin-bottom: 0px;
+}
+
+.checkBox {
+ margin: 10px;
+
+ font-size: 20px;
+ color: rgb(33, 33, 59);
+}
\ No newline at end of file
diff --git a/src/components/SearchBar.js b/src/components/SearchBar.js
new file mode 100644
index 0000000..25f6e8d
--- /dev/null
+++ b/src/components/SearchBar.js
@@ -0,0 +1,26 @@
+import React from 'react';
+
+import './SearchBar.css';
+
+export default function SearchBar({onSearchChange, onCheck}) {
+
+ function updateSearchString (event) {
+ const newSearchString = event.target.value;
+ onSearchChange(newSearchString);
+ }
+
+ function handleCheckBox () {
+ onCheck();
+ }
+
+ return (
+
+ )
+}