diff --git a/css/style.css b/css/style.css index 89b6cb5..2d39d8b 100644 --- a/css/style.css +++ b/css/style.css @@ -147,7 +147,7 @@ main::after{ font-size: 30px !important; } .mx{ - max-width: 300px !important; + max-width: 400px !important; } } diff --git a/index.html b/index.html index 3314dec..cece988 100644 --- a/index.html +++ b/index.html @@ -80,7 +80,7 @@

Shop With Us

- +
@@ -90,8 +90,22 @@

Our Products

Lorem ipsum dolor sit amet consectetur adipisicing elit. Repudiandae nostrum natus excepturi fuga ullam accusantium vel ut eveniet aut consequatur laboriosam ipsam.

-
-
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
@@ -297,7 +311,7 @@

Featured Products

- watch + watch

About This Product

@@ -328,7 +342,7 @@

Price:

style="color: var(--primary); border-color: var(--primary);">LEARN MORE
- watch + watch
@@ -347,10 +361,10 @@

Trusted Merchant

people
-
+
MERCHANT COMPANY

About Us

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui fuga ipsa, repellat blanditiis nihil, consectetur. +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui fuga ipsa, repellat blanditiis nihil, consectetur. Consequuntur eum inventore, rem maxime, nisi excepturi ipsam libero ratione adipisci alias eius vero vel!

@@ -600,7 +614,7 @@

Attractive Blog Title

- +

Attractive Blog Title

Ham Brook @@ -624,7 +638,7 @@

Get In Touch

- +
@@ -736,6 +750,6 @@

Have a Question?

- + \ No newline at end of file diff --git a/js/search.js b/js/search.js new file mode 100644 index 0000000..dda8c51 --- /dev/null +++ b/js/search.js @@ -0,0 +1,121 @@ +const Pname = document.getElementById("Pname") +const catagory = document.getElementById("Pcatagory") +const budget = document.getElementById("budget") +const productsContainer = document.getElementById("productsContainer") +let prodcuts = [ + { + id: 0, + name: "Golden Watch", + image: "images/watch1.png", + price: "$200.00", + catagory: "Accessories" + + }, + { + id: 1, + name: "Silver Watch", + image: "images/watch2.png", + price: "$100.00", + catagory: "Accessories" + + }, + { + id: 2, + name: "Brown Shoes", + image: "images/shoes.png", + price: "$80.00", + catagory: "Fashion" + + }, + { + id: 3, + name: "Grey Hoodie", + image: "images/hoodie1.png", + price: "$100.00", + catagory: "Fashion" + + }, + { + id: 4, + name: "Black Sunglasses", + image: "images/sunglasses2.png", + price: "$700.00", + catagory: "Accessories" + + }, + { + id: 5, + name: "White Cap", + image: "images/cap1.png", + price: "$30.00", + catagory: "Sport" + + }, + { + id: 6, + name: "Football Shoes", + image: "images/football1.png", + price: "$100.00", + catagory: "Sport" + + }, + { + id: 7, + name: "Blue T-Shirt", + image: "images/shirt1.png", + price: "$60.00", + catagory: "Fashion" + + }, + +] +let productsToDraw = [...prodcuts] + +Pname.addEventListener("keyup", filterInput) +catagory.addEventListener("keyup", filterInput) +budget.addEventListener("keyup", filterInput) + +function filterInput() { + console.log(Pname.value) + productsToDraw = prodcuts.filter((product) => product.name.toLowerCase().includes(Pname.value.toLowerCase().trim())) + productsToDraw = productsToDraw.filter((product) => product.catagory.toLowerCase().includes(catagory.value.toLowerCase().trim())) + if (budget.value) { + productsToDraw = productsToDraw.filter((product) => { + let price = +product.price.replace("$", "") + console.log(price) + return price <= budget.value + }) + } + renderProducts() +} + +function renderProducts() { + + productsContainer.textContent = "" + for (let i = 0; i < productsToDraw.length; i++){ + productsContainer.innerHTML += ` +
+
+
+ Golden Watch +
+
+
${productsToDraw[i].name}
+

${productsToDraw[i].price}

+ + + + + +

Catagory: ${productsToDraw[i].catagory}

+
+ + +
+
+
+
+ ` + } +} +window.onload = renderProducts \ No newline at end of file diff --git a/register.html b/register.html index 34b48ed..cec8522 100644 --- a/register.html +++ b/register.html @@ -51,6 +51,6 @@
Already have an account? - + \ No newline at end of file