From bd38b4e670b74f4c5ce081694c771dcf0f6ce23e Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Fri, 21 Jun 2024 22:36:22 +0300
Subject: [PATCH 01/38] added embla carousal
---
package.json | 3 +
src/pages/shop/sections/Banner/Carousal.jsx | 82 +++++++++++++++++++++
2 files changed, 85 insertions(+)
create mode 100644 src/pages/shop/sections/Banner/Carousal.jsx
diff --git a/package.json b/package.json
index 1743a34b..633df16d 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,9 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^2.30.0",
+ "embla-carousel": "^8.1.5",
+ "embla-carousel-autoplay": "^8.1.5",
+ "embla-carousel-react": "^8.1.5",
"html-react-parser": "^5.0.6",
"lucide-react": "^0.395.0",
"million": "^3.0.2",
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
new file mode 100644
index 00000000..6f9e7521
--- /dev/null
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -0,0 +1,82 @@
+import { useState, useCallback, useEffect } from "react";
+import banner from "../../../../assets/images/shop-page/shop-banner.jpg";
+import Autoplay from "embla-carousel-autoplay";
+import useEmblaCarousel from "embla-carousel-react";
+import "./banner.css";
+
+const DotButton = ({ selected, onClick }) => (
+
+);
+
+export default function EmblaCarousel() {
+ const [viewportRef, embla] = useEmblaCarousel({ loop: true }, [Autoplay()]);
+
+ const [selectedIndex, setSelectedIndex] = useState(0);
+ const [scrollSnaps, setScrollSnaps] = useState([]);
+
+ const scrollTo = useCallback(
+ (index) => embla && embla.scrollTo(index),
+ [embla]
+ );
+
+ const onSelect = useCallback(() => {
+ if (!embla) return;
+ setSelectedIndex(embla.selectedScrollSnap());
+ }, [embla, setSelectedIndex]);
+
+ useEffect(() => {
+ if (!embla) return;
+ onSelect();
+ setScrollSnaps(embla.scrollSnapList());
+ embla.on("select", onSelect);
+ }, [embla, setScrollSnaps, onSelect]);
+
+ const slides = Array.from(Array(5).keys());
+ return (
+ <>
+
+
+
+ {slides.map((index) => (
+
+
+
+ ))}
+
+
+
+
+
+ SpaceYaTech Hoodies
+
+
+ Buy out most stylish tech themed items
+
+
From KES 2,600
+
+ Shop Now
+
+
+ {scrollSnaps.map((_, index) => (
+ scrollTo(index)}
+ />
+ ))}
+
+
+ >
+ );
+}
From 39afc70ade3d57a73d8f46519487dc6ec2abe371 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Fri, 21 Jun 2024 22:36:36 +0300
Subject: [PATCH 02/38] banner styles
---
src/pages/shop/sections/Banner/banner.css | 48 +++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 src/pages/shop/sections/Banner/banner.css
diff --git a/src/pages/shop/sections/Banner/banner.css b/src/pages/shop/sections/Banner/banner.css
new file mode 100644
index 00000000..4aa5f7b3
--- /dev/null
+++ b/src/pages/shop/sections/Banner/banner.css
@@ -0,0 +1,48 @@
+.embla {
+ position: relative;
+}
+
+.embla__viewport {
+ overflow: hidden;
+ width: 100%;
+}
+
+.embla__viewport.is-draggable {
+ cursor: move;
+ cursor: grab;
+}
+
+.embla__viewport.is-dragging {
+ cursor: grabbing;
+}
+
+.embla__container {
+ display: flex;
+ user-select: none;
+ -webkit-touch-callout: none;
+ -khtml-user-select: none;
+ -webkit-tap-highlight-color: transparent;
+ margin-left: -10px;
+}
+
+.embla__slide {
+ position: relative;
+ min-width: 100%;
+ padding-left: 10px;
+}
+
+.embla__dot {
+ cursor: pointer;
+ position: relative;
+ padding: 0;
+ outline: 0;
+ border: 0;
+}
+
+.embla__dot:after {
+ background-color: #efefef;
+ width: 100%;
+ height: 4px;
+ border-radius: 2px;
+ content: "";
+}
From a9539a014ad26cce95abdbd0a6ad82937d705638 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Fri, 21 Jun 2024 22:36:55 +0300
Subject: [PATCH 03/38] added banner
---
src/pages/shop/Homepage.jsx | 10 ++++-----
src/pages/shop/sections/Banner.jsx | 26 ------------------------
src/pages/shop/sections/Banner/index.jsx | 13 ++++++++++++
3 files changed, 18 insertions(+), 31 deletions(-)
delete mode 100644 src/pages/shop/sections/Banner.jsx
create mode 100644 src/pages/shop/sections/Banner/index.jsx
diff --git a/src/pages/shop/Homepage.jsx b/src/pages/shop/Homepage.jsx
index 54724647..f19e077f 100644
--- a/src/pages/shop/Homepage.jsx
+++ b/src/pages/shop/Homepage.jsx
@@ -1,5 +1,5 @@
import SeoMetadata from "../../components/SeoMetadata";
-import Banner from "./sections/Banner";
+import Banner from "./sections/Banner/index";
import CategoriesSection from "./sections/CategoriesSection";
import PopularItemsSection from "./sections/PopularItemsSection";
// import CategoriesProducts from "./sections/CategoriesProducts";
@@ -16,11 +16,11 @@ function Homepage() {
ogImageAlt="SpaceYaTech logo, social media handles, website URL, email, and more on a muted background."
siteName="SpaceYaTech Shop"
/>
-
+
-
- {/*
*/}
-
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
>
);
diff --git a/src/pages/shop/sections/Banner.jsx b/src/pages/shop/sections/Banner.jsx
deleted file mode 100644
index 1b6abdc0..00000000
--- a/src/pages/shop/sections/Banner.jsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import banner from "../../../assets/images/shop-page/shop-banner.jpg";
-
-function Banner() {
- return (
-
-
-
- Elevate your style with our exclusive collection of
- merchandise.
-
-
-
- Shop now
-
-
-
- );
-}
-
-export default Banner;
diff --git a/src/pages/shop/sections/Banner/index.jsx b/src/pages/shop/sections/Banner/index.jsx
new file mode 100644
index 00000000..6468fc69
--- /dev/null
+++ b/src/pages/shop/sections/Banner/index.jsx
@@ -0,0 +1,13 @@
+import EmblaCarousel from "./Carousal";
+
+function Banner() {
+ return (
+
+ );
+}
+
+export default Banner;
From 8b98e20c6f02a1ae893574b7e9acf870c7ad4c63 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 10:51:17 +0300
Subject: [PATCH 04/38] lazy load img
---
src/pages/shop/sections/Banner/Carousal.jsx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index 6f9e7521..2bfbb0ab 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -3,6 +3,7 @@ import banner from "../../../../assets/images/shop-page/shop-banner.jpg";
import Autoplay from "embla-carousel-autoplay";
import useEmblaCarousel from "embla-carousel-react";
import "./banner.css";
+import { LazyLoadImage } from "react-lazy-load-image-component";
const DotButton = ({ selected, onClick }) => (
{slides.map((index) => (
-
))}
From b21138d1cbd7f501ad5aedd6b95ac1fe22651320 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 14:00:24 +0300
Subject: [PATCH 05/38] faq update
---
src/components/FAQ.jsx | 12 +++-----
src/pages/landingPage/sections/FaqSection.jsx | 3 +-
src/pages/shop/data.js | 20 +++++++++++++
src/pages/shop/sections/FaqSection.jsx | 29 +++++++++++++++++++
4 files changed, 55 insertions(+), 9 deletions(-)
create mode 100644 src/pages/shop/data.js
create mode 100644 src/pages/shop/sections/FaqSection.jsx
diff --git a/src/components/FAQ.jsx b/src/components/FAQ.jsx
index 3b77a7c4..475285a2 100644
--- a/src/components/FAQ.jsx
+++ b/src/components/FAQ.jsx
@@ -2,9 +2,7 @@
import { FaChevronDown, FaChevronUp } from "react-icons/fa";
import { useState } from "react";
-import { questions } from "../pages/landingPage/data";
-
-function FAQ() {
+function FAQ({ questions }) {
const [activeQuestion, setActiveQuestion] = useState(null);
const toggleQuestion = (index) => {
@@ -16,14 +14,12 @@ function FAQ() {
{questions.map((question, index) => (
- {question.answer}
+ {question.answer}
))}
diff --git a/src/pages/landingPage/sections/FaqSection.jsx b/src/pages/landingPage/sections/FaqSection.jsx
index 0384733b..24720ae9 100644
--- a/src/pages/landingPage/sections/FaqSection.jsx
+++ b/src/pages/landingPage/sections/FaqSection.jsx
@@ -1,6 +1,7 @@
import React from "react";
import { FAQ } from "../../../components";
+import { questions } from "../data";
function FaqSection() {
return (
@@ -17,7 +18,7 @@ function FaqSection() {
-
+
);
}
diff --git a/src/pages/shop/data.js b/src/pages/shop/data.js
new file mode 100644
index 00000000..39db2e66
--- /dev/null
+++ b/src/pages/shop/data.js
@@ -0,0 +1,20 @@
+export const questions = [
+ {
+ id: 1,
+ question: "Is SpaceYaTech free?",
+ answer:
+ "Yes, SpaceYaTech is totally free for anyone who wishes to learn technology and contribute to Open Source",
+ },
+ {
+ id: 2,
+ question: "Does SpaceYaTech only mentor developers?",
+ answer:
+ "No, SpaceYaTech mentors anyone who is involved in modern technology. This includes developers, designers, product managers, and more. SpaceYaTech believes that everyone has the potential to learn and grow in the tech industry, and they are committed to providing mentorship to anyone who wants it.",
+ },
+ {
+ id: 3,
+ question: "Does SpaceYaTech pay mentors?",
+ answer:
+ "No, SpaceYaTech does not pay mentors. However, mentors do receive a number of benefits.",
+ },
+];
diff --git a/src/pages/shop/sections/FaqSection.jsx b/src/pages/shop/sections/FaqSection.jsx
new file mode 100644
index 00000000..f399de08
--- /dev/null
+++ b/src/pages/shop/sections/FaqSection.jsx
@@ -0,0 +1,29 @@
+import { FAQ } from "@/components";
+import { questions } from "../data";
+
+const FaqSection = () => {
+ return (
+
+
+
+ Frequently Asked Questions
+
+
+
+ );
+};
+
+const FaqSeperator = () => {
+ return (
+
+ );
+};
+export default FaqSection;
From 061a84df7d0cfd7a67355356d605d7bb21940641 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 15:11:10 +0300
Subject: [PATCH 06/38] carticon
---
src/components/shop/CartIcon.jsx | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 src/components/shop/CartIcon.jsx
diff --git a/src/components/shop/CartIcon.jsx b/src/components/shop/CartIcon.jsx
new file mode 100644
index 00000000..ea71a484
--- /dev/null
+++ b/src/components/shop/CartIcon.jsx
@@ -0,0 +1,14 @@
+import { MdAddShoppingCart } from "react-icons/md";
+
+const CartIcon = () => {
+ return (
+
+ );
+};
+export default CartIcon;
From 9e7a411a91fa36735c8dfca0fc6d1be6c3562102 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 15:11:28 +0300
Subject: [PATCH 07/38] search design
---
src/components/shop/SearchInput.jsx | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 src/components/shop/SearchInput.jsx
diff --git a/src/components/shop/SearchInput.jsx b/src/components/shop/SearchInput.jsx
new file mode 100644
index 00000000..b564c8bd
--- /dev/null
+++ b/src/components/shop/SearchInput.jsx
@@ -0,0 +1,26 @@
+import { useState } from "react";
+import { IoMdSearch } from "react-icons/io";
+
+const SearchInput = () => {
+ const [searchText, setSearchText] = useState("");
+ return (
+
+ );
+};
+export default SearchInput;
From 77850837ed1e44bd133de1be95a8824839642412 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 15:11:37 +0300
Subject: [PATCH 08/38] sort design
---
src/components/shop/SortItems.jsx | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 src/components/shop/SortItems.jsx
diff --git a/src/components/shop/SortItems.jsx b/src/components/shop/SortItems.jsx
new file mode 100644
index 00000000..b5902102
--- /dev/null
+++ b/src/components/shop/SortItems.jsx
@@ -0,0 +1,31 @@
+import { IoFilter } from "react-icons/io5";
+import { Menu } from "@headlessui/react";
+
+const SortItems = () => {
+ return (
+
+
+
+
+ Sort
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+export default SortItems;
From 09b84d173a612da8174cb3be3fe1a0d43338f57b Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 15:12:01 +0300
Subject: [PATCH 09/38] filter section design
---
src/pages/shop/sections/FilterSection.jsx | 35 +++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 src/pages/shop/sections/FilterSection.jsx
diff --git a/src/pages/shop/sections/FilterSection.jsx b/src/pages/shop/sections/FilterSection.jsx
new file mode 100644
index 00000000..c91c9b7d
--- /dev/null
+++ b/src/pages/shop/sections/FilterSection.jsx
@@ -0,0 +1,35 @@
+import SearchInput from "@/components/shop/SearchInput";
+import SortItems from "@/components/shop/SortItems";
+
+const FilterSection = () => {
+ return (
+
+ );
+};
+
+const Categories = () => {
+ return (
+
+
+
+
+
+
+ );
+};
+
+const CategoryItem = ({ name }) => {
+ return (
+
+ {name}
+
+ );
+};
+
+export default FilterSection;
From 9b044134e89fd5a957ca982842dbd2161b20dea6 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 16:52:53 +0300
Subject: [PATCH 10/38] fixed mobile responsiveness
---
src/components/shop/CartIcon.jsx | 4 +--
src/components/shop/SearchInput.jsx | 2 +-
src/pages/shop/sections/Banner/Carousal.jsx | 4 +--
src/pages/shop/sections/Banner/index.jsx | 2 +-
src/pages/shop/sections/FilterSection.jsx | 38 ++++++++++++++++++---
5 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/src/components/shop/CartIcon.jsx b/src/components/shop/CartIcon.jsx
index ea71a484..e1a37442 100644
--- a/src/components/shop/CartIcon.jsx
+++ b/src/components/shop/CartIcon.jsx
@@ -2,8 +2,8 @@ import { MdAddShoppingCart } from "react-icons/md";
const CartIcon = () => {
return (
-
-
+
+
diff --git a/src/components/shop/SearchInput.jsx b/src/components/shop/SearchInput.jsx
index b564c8bd..a1cb6f7c 100644
--- a/src/components/shop/SearchInput.jsx
+++ b/src/components/shop/SearchInput.jsx
@@ -15,7 +15,7 @@ const SearchInput = () => {
e.preventDefault()}
>
Search
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index 2bfbb0ab..01d62791 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -58,10 +58,10 @@ export default function EmblaCarousel() {
-
+
SpaceYaTech Hoodies
-
+
Buy out most stylish tech themed items
From KES 2,600
diff --git a/src/pages/shop/sections/Banner/index.jsx b/src/pages/shop/sections/Banner/index.jsx
index 6468fc69..7fa6b797 100644
--- a/src/pages/shop/sections/Banner/index.jsx
+++ b/src/pages/shop/sections/Banner/index.jsx
@@ -2,7 +2,7 @@ import EmblaCarousel from "./Carousal";
function Banner() {
return (
-
+
diff --git a/src/pages/shop/sections/FilterSection.jsx b/src/pages/shop/sections/FilterSection.jsx
index c91c9b7d..99f383ef 100644
--- a/src/pages/shop/sections/FilterSection.jsx
+++ b/src/pages/shop/sections/FilterSection.jsx
@@ -1,11 +1,14 @@
import SearchInput from "@/components/shop/SearchInput";
import SortItems from "@/components/shop/SortItems";
+import { Menu } from "@headlessui/react";
+import { IoMenu } from "react-icons/io5";
const FilterSection = () => {
return (
-
+
+
@@ -15,7 +18,7 @@ const FilterSection = () => {
const Categories = () => {
return (
-
+
@@ -26,10 +29,37 @@ const Categories = () => {
const CategoryItem = ({ name }) => {
return (
-
- {name}
+
+ {name}
);
};
+const MobileCategories = () => {
+ return (
+
+
+
+
+ Categories
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
export default FilterSection;
From 1d620b4a7a945e05f1d6a6327c152a8644d1a30f Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sat, 22 Jun 2024 17:18:19 +0300
Subject: [PATCH 11/38] section wrapper
---
src/components/shop/CartIcon.jsx | 13 +++++----
src/components/shop/SectionWrapper.jsx | 4 +++
src/pages/shop/Homepage.jsx | 12 ++++++---
src/pages/shop/sections/Banner/index.jsx | 13 +++++----
src/pages/shop/sections/FaqSection.jsx | 33 +++++++++--------------
src/pages/shop/sections/FilterSection.jsx | 17 +++++++-----
6 files changed, 51 insertions(+), 41 deletions(-)
create mode 100644 src/components/shop/SectionWrapper.jsx
diff --git a/src/components/shop/CartIcon.jsx b/src/components/shop/CartIcon.jsx
index e1a37442..5129412b 100644
--- a/src/components/shop/CartIcon.jsx
+++ b/src/components/shop/CartIcon.jsx
@@ -1,14 +1,17 @@
import { MdAddShoppingCart } from "react-icons/md";
+import SectionWrapper from "./SectionWrapper";
const CartIcon = () => {
return (
-
-
-
+
);
};
export default CartIcon;
diff --git a/src/components/shop/SectionWrapper.jsx b/src/components/shop/SectionWrapper.jsx
new file mode 100644
index 00000000..7055c3aa
--- /dev/null
+++ b/src/components/shop/SectionWrapper.jsx
@@ -0,0 +1,4 @@
+const SectionWrapper = ({ children }) => {
+ return
{children}
;
+};
+export default SectionWrapper;
diff --git a/src/pages/shop/Homepage.jsx b/src/pages/shop/Homepage.jsx
index f19e077f..a6496528 100644
--- a/src/pages/shop/Homepage.jsx
+++ b/src/pages/shop/Homepage.jsx
@@ -1,8 +1,11 @@
+import CartIcon from "@/components/shop/CartIcon";
import SeoMetadata from "../../components/SeoMetadata";
import Banner from "./sections/Banner/index";
import CategoriesSection from "./sections/CategoriesSection";
import PopularItemsSection from "./sections/PopularItemsSection";
-// import CategoriesProducts from "./sections/CategoriesProducts";
+import FilterSection from "./sections/FilterSection";
+import FaqSection from "./sections/FaqSection";
+import CategoriesProducts from "./sections/CategoriesProducts";
function Homepage() {
return (
@@ -16,10 +19,13 @@ function Homepage() {
ogImageAlt="SpaceYaTech logo, social media handles, website URL, email, and more on a muted background."
siteName="SpaceYaTech Shop"
/>
-
+
+
+
+
+
{/*
*/}
- {/*
*/}
{/*
*/}
>
diff --git a/src/pages/shop/sections/Banner/index.jsx b/src/pages/shop/sections/Banner/index.jsx
index 7fa6b797..8c7b1184 100644
--- a/src/pages/shop/sections/Banner/index.jsx
+++ b/src/pages/shop/sections/Banner/index.jsx
@@ -1,12 +1,15 @@
+import SectionWrapper from "@/components/shop/SectionWrapper";
import EmblaCarousel from "./Carousal";
function Banner() {
return (
-
+
+
+
);
}
diff --git a/src/pages/shop/sections/FaqSection.jsx b/src/pages/shop/sections/FaqSection.jsx
index f399de08..a6a24f6e 100644
--- a/src/pages/shop/sections/FaqSection.jsx
+++ b/src/pages/shop/sections/FaqSection.jsx
@@ -1,29 +1,20 @@
-import { FAQ } from "@/components";
+import { FAQ, LandingWrapper } from "@/components";
import { questions } from "../data";
+import SectionWrapper from "@/components/shop/SectionWrapper";
const FaqSection = () => {
return (
-
-
-
- Frequently Asked Questions
-
-
-
+
+
+
+
+ Frequently Asked Questions
+
+
+
+
+
);
};
-const FaqSeperator = () => {
- return (
-
- );
-};
export default FaqSection;
diff --git a/src/pages/shop/sections/FilterSection.jsx b/src/pages/shop/sections/FilterSection.jsx
index 99f383ef..212b75ee 100644
--- a/src/pages/shop/sections/FilterSection.jsx
+++ b/src/pages/shop/sections/FilterSection.jsx
@@ -1,18 +1,21 @@
import SearchInput from "@/components/shop/SearchInput";
+import SectionWrapper from "@/components/shop/SectionWrapper";
import SortItems from "@/components/shop/SortItems";
import { Menu } from "@headlessui/react";
import { IoMenu } from "react-icons/io5";
const FilterSection = () => {
return (
-
-
-
+
);
};
From 25523c1116942a17add5aee6217958a4d504dea5 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sun, 23 Jun 2024 11:42:35 +0300
Subject: [PATCH 12/38] updated category filter
---
src/pages/shop/data.js | 8 +++++
src/pages/shop/sections/FilterSection.jsx | 39 +++++++++++++----------
2 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/src/pages/shop/data.js b/src/pages/shop/data.js
index 39db2e66..a439d203 100644
--- a/src/pages/shop/data.js
+++ b/src/pages/shop/data.js
@@ -18,3 +18,11 @@ export const questions = [
"No, SpaceYaTech does not pay mentors. However, mentors do receive a number of benefits.",
},
];
+
+export const categories = [
+ "hoodies",
+ "T-shirts",
+ "cups",
+ "bookmarks",
+ "jackets",
+];
diff --git a/src/pages/shop/sections/FilterSection.jsx b/src/pages/shop/sections/FilterSection.jsx
index 212b75ee..49cc7d3f 100644
--- a/src/pages/shop/sections/FilterSection.jsx
+++ b/src/pages/shop/sections/FilterSection.jsx
@@ -3,6 +3,8 @@ import SectionWrapper from "@/components/shop/SectionWrapper";
import SortItems from "@/components/shop/SortItems";
import { Menu } from "@headlessui/react";
import { IoMenu } from "react-icons/io5";
+import { Link, useParams } from "react-router-dom";
+import { categories } from "../data";
const FilterSection = () => {
return (
@@ -22,19 +24,28 @@ const FilterSection = () => {
const Categories = () => {
return (
-
-
-
-
+ {categories.map((item, i) => (
+
+ ))}
);
};
const CategoryItem = ({ name }) => {
+ const params = useParams();
+ const category = params.category === name;
+
return (
-
- {name}
-
+
+
+ {name}
+
+
);
};
@@ -50,15 +61,11 @@ const MobileCategories = () => {
anchor="bottom"
className="absolute md:static top-10 z-10 right-0 w-48 py-1 px-2 bg-white rounded-md flex flex-col md:flex-row gap-2 border shadow-sm"
>
-
-
-
-
-
-
-
-
-
+ {categories.map((item, i) => (
+
+
+
+ ))}
From 8144fd4805af166287dde9d2bb17a5049a596794 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sun, 23 Jun 2024 12:17:08 +0300
Subject: [PATCH 13/38] sort functionality
---
src/components/shop/SortItems.jsx | 18 +++++++---
.../shop/sections/CategoriesProducts.jsx | 36 ++++++++++++-------
2 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/src/components/shop/SortItems.jsx b/src/components/shop/SortItems.jsx
index b5902102..2fd7b8d6 100644
--- a/src/components/shop/SortItems.jsx
+++ b/src/components/shop/SortItems.jsx
@@ -1,7 +1,11 @@
import { IoFilter } from "react-icons/io5";
import { Menu } from "@headlessui/react";
+import { Link, useLocation } from "react-router-dom";
const SortItems = () => {
+ const { pathname } = useLocation();
+ const path = pathname.includes("category") ? pathname : "/shop/items";
+
return (
@@ -14,14 +18,20 @@ const SortItems = () => {
className="absolute top-10 z-10 right-0 w-48 bg-white py-2 px-4 rounded-md flex flex-col gap-2 border shadow-sm"
>
-
+
-
+
diff --git a/src/pages/shop/sections/CategoriesProducts.jsx b/src/pages/shop/sections/CategoriesProducts.jsx
index 067e88f1..7102591c 100644
--- a/src/pages/shop/sections/CategoriesProducts.jsx
+++ b/src/pages/shop/sections/CategoriesProducts.jsx
@@ -1,11 +1,16 @@
import { useEffect, useState } from "react";
-import { useParams, Link } from "react-router-dom";
+import { useParams, Link, useSearchParams } from "react-router-dom";
import { useSwagList } from "../../../hooks/Queries/shop/useSwagList";
import ItemHeader from "./ItemHeader";
import { LazyLoadImage } from "react-lazy-load-image-component";
+import FilterSection from "./FilterSection";
+import SectionWrapper from "@/components/shop/SectionWrapper";
function CategoriesProducts() {
const params = useParams();
+ const [searchParams] = useSearchParams();
+ const sort = searchParams.get("sort");
+
const [products, setProducts] = useState([
{
id: 1,
@@ -77,22 +82,27 @@ function CategoriesProducts() {
const { data: swagList, isSuccess } = useSwagList();
useEffect(() => {
- setProducts(
+ const data =
swagList?.filter(
(item) => item.category.toLowerCase() === params?.category.toLowerCase()
- ) || []
- );
- }, [swagList, params]);
+ ) || [];
+ if (sort === "low") {
+ setProducts(data.sort((a, b) => +a.price - +b.price));
+ } else if (sort === "high") {
+ setProducts(data.sort((a, b) => +b.price - +a.price));
+ } else {
+ setProducts(data);
+ }
+ }, [swagList, params, sort]);
return (
<>
-
setOpen((prev) => !prev)} />
+
+ setOpen((prev) => !prev)} />
+
+
-
-
- {params?.category}
-
-
+
{isSuccess &&
products.map((product) => (
@@ -102,7 +112,7 @@ function CategoriesProducts() {
to={`/shop/item/${product.id}`}
>
-
))}
-
+
>
);
From 4e7bc0617e1e4d2c53d833ef037ec974482e6843 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Sun, 23 Jun 2024 13:19:52 +0300
Subject: [PATCH 14/38] updated search
---
src/components/shop/SearchInput.jsx | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/components/shop/SearchInput.jsx b/src/components/shop/SearchInput.jsx
index a1cb6f7c..95ce82de 100644
--- a/src/components/shop/SearchInput.jsx
+++ b/src/components/shop/SearchInput.jsx
@@ -1,10 +1,21 @@
import { useState } from "react";
import { IoMdSearch } from "react-icons/io";
+import { useNavigate } from "react-router-dom";
const SearchInput = () => {
const [searchText, setSearchText] = useState("");
+ const navigate = useNavigate();
+
+ function handleSubmit(e) {
+ e.preventDefault();
+ navigate(`/shop/items?search=${searchText}`);
+ }
+
return (
-
>
);
From af0abb8040fd410b81651e485f8c0083565de60c Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Mon, 24 Jun 2024 16:40:14 +0300
Subject: [PATCH 24/38] query categoires
---
src/hooks/Queries/shop/useSwagList.jsx | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/hooks/Queries/shop/useSwagList.jsx b/src/hooks/Queries/shop/useSwagList.jsx
index e07198d3..40e250bd 100644
--- a/src/hooks/Queries/shop/useSwagList.jsx
+++ b/src/hooks/Queries/shop/useSwagList.jsx
@@ -38,4 +38,20 @@ const useSingleSwag = (id) =>
refetchOnWindowFocus: false,
});
-export { useSwagList, useSingleSwag };
+const fetchCategorySwags = async (name) => {
+ try {
+ const response = await publicAxios.get(`/swaggs/?category=${name}`);
+ return response.data;
+ } catch (error) {
+ console.error("Error fetching category list: ", error);
+ throw error;
+ }
+};
+const useCategorySwag = (name) =>
+ useQuery({
+ queryKey: ["category swag"],
+ queryFn: () => fetchCategorySwags(name),
+ refetchOnWindowFocus: false,
+ });
+
+export { useSwagList, useSingleSwag, useCategorySwag };
From 6061197e7d928f7ab5ee87ba6532562aea35e8bb Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 25 Jun 2024 20:53:08 +0300
Subject: [PATCH 25/38] rm hover on mobile
---
src/components/shop/ProductCard.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/shop/ProductCard.jsx b/src/components/shop/ProductCard.jsx
index 500a4794..821fbda2 100644
--- a/src/components/shop/ProductCard.jsx
+++ b/src/components/shop/ProductCard.jsx
@@ -52,7 +52,7 @@ const ProductCard = ({ product }) => {
KES {addCommaSeparator(Number(product.price))}
-
+
From 06fece2bd29f778631e43c282e374eb4c1095feb Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Thu, 27 Jun 2024 15:12:46 +0300
Subject: [PATCH 26/38] rm query category
---
src/hooks/Queries/shop/useSwagList.jsx | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/src/hooks/Queries/shop/useSwagList.jsx b/src/hooks/Queries/shop/useSwagList.jsx
index 40e250bd..31e258af 100644
--- a/src/hooks/Queries/shop/useSwagList.jsx
+++ b/src/hooks/Queries/shop/useSwagList.jsx
@@ -38,20 +38,4 @@ const useSingleSwag = (id) =>
refetchOnWindowFocus: false,
});
-const fetchCategorySwags = async (name) => {
- try {
- const response = await publicAxios.get(`/swaggs/?category=${name}`);
- return response.data;
- } catch (error) {
- console.error("Error fetching category list: ", error);
- throw error;
- }
-};
-const useCategorySwag = (name) =>
- useQuery({
- queryKey: ["category swag"],
- queryFn: () => fetchCategorySwags(name),
- refetchOnWindowFocus: false,
- });
-
-export { useSwagList, useSingleSwag, useCategorySwag };
+export { useSwagList, useSingleSwag };
\ No newline at end of file
From 0ce8cd1a651a2251423cb431d0be1102d4227554 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 12:21:44 +0300
Subject: [PATCH 27/38] carticon update
---
src/components/Header.jsx | 57 ++++++++++++++++++--------------
src/components/shop/CartIcon.jsx | 8 ++---
2 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/src/components/Header.jsx b/src/components/Header.jsx
index 4b91abe7..d0d5c30d 100644
--- a/src/components/Header.jsx
+++ b/src/components/Header.jsx
@@ -5,6 +5,7 @@ import { LazyLoadImage } from "react-lazy-load-image-component";
import { Link, useLocation } from "react-router-dom";
import logo from "../assets/images/sytLogo.png";
+import CartIcon from "./shop/CartIcon";
const navLinks = [
{
@@ -63,30 +64,38 @@ function Header() {
{/* mobile menu */}
- {showNavlinks ? (
- setShowNavlinks(false)}
- >
- {" "}
- {/* Close Icon */}
-
- ) : (
- setShowNavlinks(true)}
- >
- {" "}
- {/* Menu Icon */}
-
- )}
+
+
+
+
+ {showNavlinks ? (
+
setShowNavlinks(false)}
+ >
+ {" "}
+ {/* Close Icon */}
+
+ ) : (
+
setShowNavlinks(true)}
+ >
+ {" "}
+ {/* Menu Icon */}
+
+ )}
+
{/* mobile navlinks */}
{
return (
-
-
-
-
+
From 7a62eb08ef0a8bbd0ca7d162c4a506357422ff00 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 12:22:02 +0300
Subject: [PATCH 28/38] filter items update
---
src/components/shop/SearchInput.jsx | 2 +-
src/components/shop/SectionWrapper.jsx | 2 +-
src/components/shop/SortItems.jsx | 8 ++---
src/pages/shop/sections/FilterSection.jsx | 41 +++++++----------------
4 files changed, 19 insertions(+), 34 deletions(-)
diff --git a/src/components/shop/SearchInput.jsx b/src/components/shop/SearchInput.jsx
index 95ce82de..a6d143f6 100644
--- a/src/components/shop/SearchInput.jsx
+++ b/src/components/shop/SearchInput.jsx
@@ -26,7 +26,7 @@ const SearchInput = () => {
Search
diff --git a/src/components/shop/SectionWrapper.jsx b/src/components/shop/SectionWrapper.jsx
index 7055c3aa..b4beac33 100644
--- a/src/components/shop/SectionWrapper.jsx
+++ b/src/components/shop/SectionWrapper.jsx
@@ -1,4 +1,4 @@
const SectionWrapper = ({ children }) => {
- return {children}
;
+ return {children}
;
};
export default SectionWrapper;
diff --git a/src/components/shop/SortItems.jsx b/src/components/shop/SortItems.jsx
index 2fd7b8d6..2b2cf746 100644
--- a/src/components/shop/SortItems.jsx
+++ b/src/components/shop/SortItems.jsx
@@ -7,11 +7,11 @@ const SortItems = () => {
const path = pathname.includes("category") ? pathname : "/shop/items";
return (
-
+
-
-
- Sort
+
+
+ Sort
{
return (
@@ -23,10 +29,12 @@ const FilterSection = () => {
const Categories = () => {
return (
-
+
{categories.map((item, i) => (
))}
+ {" "}
+
);
};
@@ -38,7 +46,7 @@ const CategoryItem = ({ name }) => {
return (
{
);
};
-const MobileCategories = () => {
- return (
-
-
-
-
- Categories
-
-
- {categories.map((item, i) => (
-
-
-
- ))}
-
-
-
- );
-};
-
export default FilterSection;
From 4b60eef6069d19d761ddb6894b517710ad5abdc6 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 12:23:16 +0300
Subject: [PATCH 29/38] rm packages on banner carousal
---
src/pages/shop/Homepage.jsx | 4 +-
src/pages/shop/sections/Banner/Caroussel.jsx | 91 ++++++++++++++++++++
src/pages/shop/sections/Banner/index.jsx | 15 ++--
3 files changed, 101 insertions(+), 9 deletions(-)
create mode 100644 src/pages/shop/sections/Banner/Caroussel.jsx
diff --git a/src/pages/shop/Homepage.jsx b/src/pages/shop/Homepage.jsx
index de4d8c4c..9076e045 100644
--- a/src/pages/shop/Homepage.jsx
+++ b/src/pages/shop/Homepage.jsx
@@ -19,7 +19,9 @@ function Homepage() {
siteName="SpaceYaTech Shop"
/>
-
+
+
+
diff --git a/src/pages/shop/sections/Banner/Caroussel.jsx b/src/pages/shop/sections/Banner/Caroussel.jsx
new file mode 100644
index 00000000..05414ef6
--- /dev/null
+++ b/src/pages/shop/sections/Banner/Caroussel.jsx
@@ -0,0 +1,91 @@
+import { useSwagList } from "@/hooks/Queries/shop/useSwagList";
+import { useEffect, useRef, useState } from "react";
+import { LazyLoadImage } from "react-lazy-load-image-component";
+import { Link } from "react-router-dom";
+
+function Carousel() {
+ const [width, setWidth] = useState(0);
+ const [selectedIndex, setSelectedIndex] = useState(0);
+
+ const { data: swagList, isSuccess } = useSwagList();
+ const carouselRef = useRef(null);
+
+ useEffect(() => {
+ if (carouselRef.current) {
+ setWidth(carouselRef.current.offsetWidth + 10);
+ }
+ }, [carouselRef.current]);
+
+ const scrollToIndex = (index) => {
+ if (carouselRef.current) {
+ carouselRef.current.scrollTo({
+ left: index * width,
+ behavior: "smooth",
+ });
+ setSelectedIndex(index);
+ }
+ };
+
+ useEffect(() => {
+ const interval = setInterval(() => {
+ setSelectedIndex((prevIndex) => {
+ const newIndex = (prevIndex + 1) % swagList.length;
+ scrollToIndex(newIndex);
+ return newIndex;
+ });
+ }, 1000000); // Autoplay every 10 seconds
+
+ return () => clearInterval(interval);
+ }, [width, swagList]);
+
+ return (
+ <>
+
+
+
+ {isSuccess &&
+ swagList?.map(({ image, name, id }) => (
+
+
+
+ ))}
+
+
+
+
+
+ SpaceYaTech Hoodies
+
+
+ Buy out most stylish tech themed items
+
+
From KES 2,600
+
+ Shop Now
+
+
+ {swagList?.map((_, index) => (
+ scrollToIndex(index)}
+ />
+ ))}
+
+
+ >
+ );
+}
+
+export default Carousel;
diff --git a/src/pages/shop/sections/Banner/index.jsx b/src/pages/shop/sections/Banner/index.jsx
index 8c7b1184..b42f4663 100644
--- a/src/pages/shop/sections/Banner/index.jsx
+++ b/src/pages/shop/sections/Banner/index.jsx
@@ -1,15 +1,14 @@
-import SectionWrapper from "@/components/shop/SectionWrapper";
-import EmblaCarousel from "./Carousal";
+import Caroussel from "./Caroussel";
function Banner() {
return (
-
-
-
-
+
);
}
From 78f650a78cfa9094ca21151165dce7e4153b2850 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 13:27:56 +0300
Subject: [PATCH 30/38] css update
---
src/index.css | 1370 +++++++++++++++++-
src/pages/shop/sections/Banner/Caroussel.jsx | 91 --
src/utilities/formatPrice.jsx | 6 +
3 files changed, 1373 insertions(+), 94 deletions(-)
delete mode 100644 src/pages/shop/sections/Banner/Caroussel.jsx
create mode 100644 src/utilities/formatPrice.jsx
diff --git a/src/index.css b/src/index.css
index 91f55f00..62cb6b49 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1,4 +1,1368 @@
+@import url("https://fonts.googleapis.com/css2?family=Sora&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;500;600;700;800;900&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap");
+
@tailwind base;
- @tailwind components;
- @tailwind utilities;
-
\ No newline at end of file
+@tailwind components;
+@tailwind utilities;
+
+* {
+ font-family: "Poppins", sans-serif;
+ scroll-behavior: smooth;
+}
+
+::-webkit-scrollbar {
+ width: 0;
+ background: transparent;
+}
+
+.scrollbar::-webkit-scrollbar {
+ width: 0;
+ height: 6px;
+ background: #009975;
+}
+
+.scrollbar::-webkit-scrollbar-thumb {
+ background: #00664e;
+
+ border-radius: 12px;
+}
+
+.scrollbar::-webkit-scrollbar-track {
+ background: #009975;
+ -webkit-box-shadow: inset 0 0 6px #009975;
+ border-top: 2px solid #e5efec;
+ border-bottom: 2px solid #e5efec;
+}
+
+.hr-scrollbar::-webkit-scrollbar {
+ width: 0;
+ height: 6px;
+ background: #009975;
+}
+
+.hr-scrollbar::-webkit-scrollbar-thumb {
+ background: #00664e;
+
+ border-radius: 12px;
+}
+
+.hr-scrollbar::-webkit-scrollbar-track {
+ background: #009975;
+ -webkit-box-shadow: inset 0 0 6px #009975;
+ border-top: 2px solid #e5efec;
+ border-bottom: 2px solid #e5efec;
+}
+
+@media (min-width: 768px) {
+ .scrollbar::-webkit-scrollbar {
+ width: 6px;
+ height: 0;
+ background: #009975;
+ }
+
+ .scrollbar::-webkit-scrollbar-thumb {
+ background: #00664e;
+
+ border-radius: 12px;
+ }
+
+ .scrollbar::-webkit-scrollbar-track {
+ background: #009975;
+ -webkit-box-shadow: inset 0 0 6px #009975;
+ border-left: 2px solid #e5efec;
+ border-right: 2px solid #e5efec;
+ }
+
+ .hr-scrollbar::-webkit-scrollbar {
+ width: 6px;
+ background: #009975;
+ }
+
+ .hr-scrollbar::-webkit-scrollbar-thumb {
+ background: #00664e;
+
+ border-radius: 12px;
+ }
+
+ .hr-scrollbar::-webkit-scrollbar-track {
+ background: #009975;
+ -webkit-box-shadow: inset 0 0 6px #009975;
+ border-left: 2px solid #e5efec;
+ border-right: 2px solid #e5efec;
+ }
+}
+@layer utilities {
+ .blur-1 {
+ /* Vector */
+
+ position: absolute;
+ width: 68.01px;
+ height: 67.84px;
+ left: 500.9px;
+ top: 66.87px;
+
+ background: #009975;
+ opacity: 0.3;
+ filter: blur(15px);
+ transform: rotate(-75deg);
+ }
+
+ .blur-sm-1 {
+ /* Vector */
+ position: absolute;
+ width: 30.11px;
+ height: 27.97px;
+ left: 89px;
+ top: 62.24px;
+
+ /* Primary/Green/800 */
+
+ background: #009975;
+ opacity: 0.3;
+ filter: blur(15px);
+ transform: rotate(-75deg);
+ }
+
+ .blur-2 {
+ /* Vector */
+
+ position: absolute;
+ width: 65.91px;
+ height: 67.41px;
+ left: 693.21px;
+ top: 66px;
+
+ /* Primary/Green/800 */
+
+ background: #009975;
+ opacity: 0.3;
+ filter: blur(15px);
+ transform: matrix(1, -0.03, -0.03, -1, 0, 0);
+ }
+
+ .blur-sm-2 {
+ position: absolute;
+ width: 32.1px;
+ height: 32.83px;
+ left: 158.08px;
+ top: 70.87px;
+
+ /* Primary/Green/800 */
+
+ background: #009975;
+ opacity: 0.3;
+ filter: blur(15px);
+ transform: matrix(1, -0.03, -0.03, -1, 0, 0);
+ }
+
+ .blur-3 {
+ /* Vector */
+
+ position: absolute;
+ width: 51.81px;
+ height: 69.5px;
+ left: 885.84px;
+ top: 66px;
+
+ /* Primary/Green/800 */
+
+ background: #009975;
+ opacity: 0.3;
+ filter: blur(15px);
+ transform: rotate(-75deg);
+ }
+
+ .blur-sm-3 {
+ /* Vector */
+
+ position: absolute;
+ width: 27.18px;
+ height: 36.46px;
+ left: 223px;
+ top: 60.25px;
+
+ /* Primary/Green/800 */
+ background: #009975;
+ opacity: 0.3;
+ filter: blur(15px);
+ transform: rotate(-75deg);
+ }
+
+ .bg-primary {
+ background-color: #009975;
+ }
+
+ /* Footer */
+ .flex-1 {
+ flex-grow: 1;
+ }
+
+ .flex-3 {
+ flex-grow: 3;
+ }
+
+ .flex-2 {
+ flex-grow: 2;
+ }
+
+ .flex-center {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .flex-start {
+ display: flex;
+ align-items: flex-start;
+ justify-content: center;
+ }
+ .flex-between {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .flex-half {
+ flex: 1;
+ }
+
+ .first-letter::first-letter {
+ font-weight: bold;
+ font-size: 3rem;
+ }
+
+ /* blog bgImg */
+ .bg-blog-image {
+ background-image: url("../src/assets/images/blogs-page/blogBg.png");
+ }
+}
+
+/* Hero Image */
+
+/* Creative Shapes */
+
+.creative-shapes {
+ position: relative;
+ width: 1432px;
+ height: 519px;
+ left: 0px;
+ top: 0px;
+}
+
+.ellipse {
+ position: absolute;
+ border-radius: 50%;
+ transition:
+ transform 3s,
+ filter 3s;
+}
+
+/* Ellipse 115 */
+
+.ellipse115 {
+ position: absolute;
+ width: 48px;
+ height: 48px;
+ left: 0px;
+ top: 277px;
+
+ background: #cfe2dc;
+ opacity: 0.25;
+}
+
+/* Ellipse 116 */
+
+.ellipse116 {
+ position: absolute;
+ width: 28px;
+ height: 28px;
+ left: 87px;
+ top: 207px;
+
+ background: #63968b;
+}
+
+/* Ellipse 117 */
+
+.ellipse117 {
+ position: absolute;
+ width: 101px;
+ height: 101px;
+ left: 50px;
+ top: 246px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 118 */
+
+.ellipse118 {
+ position: absolute;
+ width: 131px;
+ height: 137px;
+ left: 151px;
+ top: 221px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 132 */
+
+.ellipse132 {
+ position: absolute;
+ width: 98px;
+ height: 102px;
+ left: 184px;
+ top: 331px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 119 */
+
+.ellipse119 {
+ position: absolute;
+ width: 33px;
+ height: 35px;
+ left: 134px;
+ top: 347px;
+
+ background: #63968b;
+}
+
+/* Ellipse 133 */
+
+.ellipse133 {
+ position: absolute;
+ width: 30px;
+ height: 30px;
+ left: 178px;
+ top: 440px;
+
+ background: #d9d9d9;
+ opacity: 0.25;
+}
+
+/* Ellipse 134 */
+
+.ellipse134 {
+ position: absolute;
+ width: 30px;
+ height: 30px;
+ left: 300px;
+ top: 394px;
+
+ background: url(.jpg), #63968b;
+}
+
+/* Ellipse 172 */
+
+.ellipse172 {
+ position: absolute;
+ width: 42px;
+ height: 42px;
+ left: 435px;
+ top: 458px;
+
+ background: #63968b;
+}
+
+/* Ellipse 173 */
+
+.ellipse173 {
+ position: absolute;
+ width: 31px;
+ height: 31px;
+ left: 496px;
+ top: 474px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 174 */
+
+.ellipse174 {
+ position: absolute;
+ width: 48px;
+ height: 48px;
+ left: 532px;
+ top: 470px;
+
+ background: url(.jpg);
+ opacity: 0.25;
+}
+
+/* Ellipse 175 */
+
+.ellipse175 {
+ position: absolute;
+ width: 156px;
+ height: 156px;
+ left: 451px;
+ top: 313px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 176 */
+
+.ellipse176 {
+ position: absolute;
+ width: 91px;
+ height: 91px;
+ left: 413px;
+ top: 331px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 135 */
+
+.ellipse135 {
+ position: absolute;
+ width: 59px;
+ height: 59px;
+ left: 283px;
+ top: 335px;
+
+ background: #63968b;
+}
+
+/* Ellipse 136 */
+
+.ellipse136 {
+ position: absolute;
+ width: 121px;
+ height: 121px;
+ left: 333px;
+ top: 331px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 120 */
+
+.ellipse120 {
+ position: absolute;
+ width: 65px;
+ height: 69px;
+ left: 200px;
+ top: 138px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 124 */
+
+.ellipse124 {
+ position: absolute;
+ width: 69px;
+ height: 69px;
+ left: 200px;
+ top: 138px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 125 */
+
+.ellipse125 {
+ position: absolute;
+ width: 69px;
+ height: 69px;
+ left: 278px;
+ top: 177px;
+
+ background: #d9d9d9;
+ opacity: 0.25;
+}
+
+/* Ellipse 126 */
+
+.ellipse126 {
+ position: absolute;
+ width: 172px;
+ height: 172px;
+ left: 289px;
+ top: 199px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 121 */
+
+.ellipse121 {
+ position: absolute;
+ width: 45px;
+ height: 45px;
+ left: 278px;
+ top: 116px;
+
+ background: #60968b;
+}
+
+/* Ellipse 127 */
+
+.ellipse127 {
+ position: absolute;
+ width: 91px;
+ height: 91px;
+ left: 328px;
+ top: 116px;
+
+ background: url(.jpg);
+}
+
+/* Ellipse 128 */
+
+.ellipse128 {
+ position: absolute;
+ width: 131px;
+ height: 131px;
+ left: 389px;
+ top: 30px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 129 */
+
+.ellipse129 {
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ left: 479px;
+ top: 56px;
+
+ background: #b3cbc4;
+ opacity: 0.45;
+}
+
+/* Ellipse 130 */
+
+.ellipse130 {
+ position: absolute;
+ width: 79px;
+ height: 79px;
+ left: 406px;
+ top: 152px;
+
+ background: #63968b;
+}
+
+/* Ellipse 131 */
+
+.ellipse1311 {
+ position: absolute;
+ width: 150px;
+ height: 150px;
+ left: 450px;
+ top: 199px;
+
+ background: #609a8f;
+ opacity: 0.75;
+}
+
+/* Ellipse 122 */
+
+.ellipse122 {
+ position: absolute;
+ width: 30px;
+ height: 30px;
+ left: 242px;
+ top: 108px;
+
+ background: url(.jpg), #60968b;
+}
+
+/* Ellipse 123 */
+
+.ellipse123 {
+ position: absolute;
+ width: 30px;
+ height: 30px;
+ left: 361px;
+ top: 26px;
+
+ background: #60968b;
+}
+
+/* Ellipse 137 */
+
+.ellipse137 {
+ position: absolute;
+ width: 30px;
+ height: 30px;
+ left: 575px;
+ top: 30px;
+
+ background: #60968b;
+}
+
+/* Ellipse 138 */
+
+.ellipse138 {
+ position: absolute;
+ width: 90px;
+ height: 90px;
+ left: 603px;
+ top: 0px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 139 */
+
+.ellipse139 {
+ position: absolute;
+ width: 116px;
+ height: 124px;
+ left: 650px;
+ top: 70px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 140 */
+
+.ellipse140 {
+ position: absolute;
+ width: 124px;
+ height: 124px;
+ left: 650px;
+ top: 70px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 141 */
+
+.ellipse141 {
+ position: absolute;
+ width: 80px;
+ height: 80px;
+ left: 580px;
+ top: 136px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 142 */
+
+.ellipse142 {
+ position: absolute;
+ width: 210px;
+ height: 210px;
+ left: 602px;
+ top: 184px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 143 */
+
+.ellipse143 {
+ position: absolute;
+ width: 80px;
+ height: 80px;
+ left: 564px;
+ top: 324px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 144 */
+
+.ellipse144 {
+ position: absolute;
+ width: 137px;
+ height: 137px;
+ left: 591px;
+ top: 382px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 145 */
+
+.ellipse145 {
+ position: absolute;
+ width: 82px;
+ height: 88px;
+ left: 716px;
+ top: 391px;
+
+ background: #668c83;
+}
+
+/* Ellipse 177 */
+
+.ellipse177 {
+ position: absolute;
+ width: 59px;
+ height: 63px;
+ left: 762px;
+ top: 336px;
+
+ background: url(.jpg), #668c83;
+}
+
+/* Ellipse 178 */
+
+.ellipse178 {
+ position: absolute;
+ width: 59px;
+ height: 63px;
+ left: 775px;
+ top: 264px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 146 */
+
+.ellipse146 {
+ position: absolute;
+ width: 141px;
+ height: 151px;
+ left: 792px;
+ top: 360px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 156 */
+
+.ellipse156 {
+ position: absolute;
+ width: 61px;
+ height: 61px;
+ left: 937px;
+ top: 420px;
+
+ background: #d9d9d9;
+ opacity: 0.35;
+}
+
+/* Ellipse 157 */
+
+.ellipse157 {
+ position: absolute;
+ width: 85px;
+ height: 85px;
+ left: 1002px;
+ top: 404px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 179 */
+
+.ellipse179 {
+ position: absolute;
+ width: 54px;
+ height: 54px;
+ left: 1019px;
+ top: 336px;
+
+ background: #6d837d;
+}
+
+/* Ellipse 158 */
+
+.ellipse158 {
+ position: absolute;
+ width: 121px;
+ height: 121px;
+ left: 1072px;
+ top: 325px;
+
+ background: #81918d;
+ opacity: 0.85;
+}
+
+/* Ellipse 164 */
+
+.ellipse164 {
+ position: absolute;
+ width: 128px;
+ height: 137px;
+ left: 1105px;
+ top: 223px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 165 */
+
+.ellipse165 {
+ position: absolute;
+ width: 121px;
+ height: 121px;
+ left: 1232px;
+ top: 212px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 167 */
+
+.ellipse167 {
+ position: absolute;
+ width: 84px;
+ height: 84px;
+ left: 1337px;
+ top: 227px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 168 */
+
+.ellipse168 {
+ position: absolute;
+ width: 56px;
+ height: 56px;
+ left: 1266px;
+ top: 325px;
+
+ background: #acb0af;
+ opacity: 0.55;
+}
+
+/* Ellipse 169 */
+
+.ellipse169 {
+ position: absolute;
+ width: 34px;
+ height: 34px;
+ left: 1193px;
+ top: 350px;
+
+ background: #707b79;
+}
+
+/* Ellipse 170 */
+
+.ellipse170 {
+ position: absolute;
+ width: 29px;
+ height: 29px;
+ left: 1091px;
+ top: 450px;
+
+ background: #6d837d;
+}
+
+/* Ellipse 171 */
+
+.ellipse171 {
+ position: absolute;
+ width: 29px;
+ height: 29px;
+ left: 1403px;
+ top: 229px;
+
+ background: #737574;
+}
+
+/* Ellipse 166 */
+
+.ellipse166 {
+ position: absolute;
+ width: 56px;
+ height: 56px;
+ left: 1260px;
+ top: 171px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 147 */
+
+.ellipse147 {
+ position: absolute;
+ width: 150px;
+ height: 150px;
+ left: 817px;
+ top: 213px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 148 */
+
+.ellipse148 {
+ position: absolute;
+ width: 115px;
+ height: 115px;
+ left: 766px;
+ top: 119px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 151 */
+
+.ellipse151 {
+ position: absolute;
+ width: 80px;
+ height: 80px;
+ left: 881px;
+ top: 159px;
+
+ background: #698981;
+}
+
+/* Ellipse 149 */
+
+.ellipse149 {
+ position: absolute;
+ width: 82px;
+ height: 82px;
+ left: 805px;
+ top: 45px;
+
+ background: #ced8d6;
+ opacity: 0.55;
+}
+
+/* Ellipse 152 */
+
+.ellipse152 {
+ position: absolute;
+ width: 106px;
+ height: 106px;
+ left: 870px;
+ top: 57px;
+
+ background: url(.jpg), #d9d9d9;
+}
+
+/* Ellipse 153 */
+
+.ellipse153 {
+ position: absolute;
+ width: 125px;
+ height: 125px;
+ left: 956px;
+ top: 69px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 159 */
+
+.ellipse159 {
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ left: 1055px;
+ top: 86px;
+
+ background: url(.jpg);
+}
+
+/* Ellipse 160 */
+
+.ellipse160 {
+ position: absolute;
+ width: 105px;
+ height: 105px;
+ left: 1198px;
+ top: 90px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 161 */
+
+.ellipse161 {
+ position: absolute;
+ width: 60px;
+ height: 60px;
+ left: 1039px;
+ top: 39px;
+
+ background: #d1d6d6;
+ opacity: 0.25;
+}
+
+/* Ellipse 162 */
+
+.ellipse162 {
+ position: absolute;
+ width: 20px;
+ height: 20px;
+ left: 1005px;
+ top: 45px;
+
+ background: #6b8781;
+}
+
+/* Ellipse 163 */
+
+.ellipse163 {
+ position: absolute;
+ width: 20px;
+ height: 20px;
+ left: 1198px;
+ top: 83px;
+
+ background: #6f7e7b;
+}
+
+/* Ellipse 154 */
+
+.ellipse154 {
+ position: absolute;
+ width: 100px;
+ height: 100px;
+ left: 949px;
+ top: 133px;
+
+ background: #d9d9d9;
+ opacity: 0.15;
+}
+
+/* Ellipse 155 */
+
+.ellipse155 {
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ left: 966px;
+ top: 210px;
+
+ background: #d9d9d9;
+}
+
+/* Ellipse 150 */
+
+.ellipse150 {
+ position: absolute;
+ width: 52px;
+ height: 52px;
+ left: 741px;
+ top: 54px;
+
+ background: #649186;
+}
+
+/* Rectangle 18291 */
+
+/* .rectangle18291 {
+ position: absolute;
+ width: 1436px;
+ height: 523px;
+ left: 0px;
+ top: 0px;
+
+ background: linear-gradient(
+ 96.14deg,
+ #59a896 10.62%,
+ #737373 96.48%,
+ #00664e 96.48%
+ );
+} */
+
+/* Ellipse 147 */
+
+.ellipse147 {
+ position: absolute;
+ width: 150px;
+ height: 150px;
+ left: 817px;
+ top: 213px;
+
+ background: url("./assets/Landing Page Images/Ellipse 147.png");
+}
+
+/* Ellipse 1411 */
+
+.ellipse1411 {
+ position: absolute;
+ width: 210px;
+ height: 210px;
+ left: 602px;
+ top: 184px;
+
+ background: url("./assets/Landing Page Images/Ellipse 1411.png");
+}
+
+/* Ellipse 128 */
+
+.ellipse128 {
+ position: absolute;
+ width: 131px;
+ height: 131px;
+ left: 389px;
+ top: 30px;
+
+ background: url("./assets/Landing Page Images/Ellipse 128.png");
+}
+
+/* Ellipse 142 */
+
+.ellipse142 {
+ position: absolute;
+ width: 101px;
+ height: 101px;
+ left: 50px;
+ top: 246px;
+
+ background: url("./assets/Landing Page Images/Ellipse 142.png"), #d9d9d9;
+}
+
+/* Ellipse 175 */
+
+.ellipse175 {
+ position: absolute;
+ width: 156px;
+ height: 156px;
+ left: 451px;
+ top: 313px;
+
+ background: url("./assets/Landing Page Images/Ellipse 175.png");
+}
+
+/* Ellipse 146 */
+
+.ellipse146 {
+ position: absolute;
+ width: 141px;
+ height: 151px;
+ left: 792px;
+ top: 360px;
+
+ background: url("./assets/Landing Page Images/Ellipse 146.png");
+}
+
+/* Ellipse 159 */
+
+.ellipse159 {
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ left: 1055px;
+ top: 86px;
+
+ background: url("./assets/Landing Page Images/Ellipse 159.png");
+}
+
+/* Ellipse 167 */
+
+.ellipse167 {
+ position: absolute;
+ width: 84px;
+ height: 84px;
+ left: 1337px;
+ top: 227px;
+
+ background: url("./assets/Landing Page Images/Ellipse 167.png");
+}
+
+/* Ellipse 160 */
+
+.ellipse160 {
+ position: absolute;
+ width: 105px;
+ height: 105px;
+ left: 1198px;
+ top: 90px;
+
+ background: url("./assets/Landing Page Images/Ellipse 160.png"), #d9d9d9;
+}
+
+/* Ellipse 118 */
+
+.ellipse118 {
+ position: absolute;
+ width: 131px;
+ height: 137px;
+ left: 151px;
+ top: 221px;
+
+ background: url("./assets/Landing Page Images/Ellipse 118.png");
+}
+
+/* Ellipse 138 */
+
+.ellipse138 {
+ position: absolute;
+ width: 90px;
+ height: 90px;
+ left: 603px;
+ top: 0px;
+
+ background: url("./assets/Landing Page Images/Ellipse 138.png");
+}
+
+/* Ellipse 141 */
+
+.ellipse141 {
+ position: absolute;
+ width: 80px;
+ height: 80px;
+ left: 580px;
+ top: 136px;
+
+ background: url("./assets/Landing Page Images/Ellipse 141.png");
+}
+
+/* Ellipse 157 */
+
+.ellipse157 {
+ position: absolute;
+ width: 85px;
+ height: 85px;
+ left: 1002px;
+ top: 404px;
+
+ background: url("./assets/Landing Page Images/Ellipse 157.png");
+}
+
+/* Ellipse 132 */
+
+.ellipse132 {
+ position: absolute;
+ width: 98px;
+ height: 102px;
+ left: 184px;
+ top: 331px;
+
+ background: url("./assets/Landing Page Images/Ellipse 132.png"), #d9d9d9;
+}
+
+/* Ellipse 131 */
+
+.ellipse131 {
+ position: absolute;
+ width: 172px;
+ height: 172px;
+ left: 289px;
+ top: 199px;
+
+ background: url("./assets/Landing Page Images/Ellipse 131.png");
+}
+
+/* Ellipse 136 */
+
+.ellipse136 {
+ position: absolute;
+ width: 121px;
+ height: 121px;
+ left: 333px;
+ top: 331px;
+
+ background: url("./assets/Landing Page Images/Ellipse 136.png");
+}
+
+/* Ellipse 124 */
+
+.ellipse124 {
+ position: absolute;
+ width: 69px;
+ height: 69px;
+ left: 200px;
+ top: 138px;
+
+ background: url("./assets/Landing Page Images/Ellipse 124.png"), #d9d9d9;
+}
+
+/* Ellipse 164 */
+
+.ellipse164 {
+ position: absolute;
+ width: 128px;
+ height: 137px;
+ left: 1105px;
+ top: 223px;
+
+ background: url("./assets/Landing Page Images/Ellipse 164.png"), #d9d9d9;
+}
+
+/* Ellipse 165 */
+
+.ellipse165 {
+ position: absolute;
+ width: 121px;
+ height: 121px;
+ left: 1232px;
+ top: 212px;
+
+ background: url("./assets/Landing Page Images/Ellipse 165.png");
+}
+
+/* Ellipse 148 */
+
+.ellipse148 {
+ position: absolute;
+ width: 115px;
+ height: 115px;
+ left: 766px;
+ top: 119px;
+
+ background: url("./assets/Landing Page Images/Ellipse 148.png");
+}
+
+/* Ellipse 152 */
+
+.ellipse152 {
+ position: absolute;
+ width: 106px;
+ height: 106px;
+ left: 870px;
+ top: 57px;
+
+ background: url("./assets/Landing Page Images/Ellipse 152.png");
+}
+
+/* Ellipse 153 */
+
+.ellipse153 {
+ position: absolute;
+ width: 125px;
+ height: 125px;
+ left: 956px;
+ top: 69px;
+
+ background: url("./assets/Landing Page Images/Ellipse 153.png");
+}
+
+/* Ellipse 155 */
+
+.ellipse155 {
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ left: 966px;
+ top: 210px;
+
+ background: url("./assets/Landing Page Images/Ellipse 155.png");
+}
+
+/* Ellipse 127 */
+
+.ellipse127 {
+ position: absolute;
+ width: 137px;
+ height: 137px;
+ left: 591px;
+ top: 382px;
+
+ background: url("./assets/Landing Page Images/Ellipse 127.png");
+}
+
+/* Ellipse 117 */
+
+.ellipse117 {
+ position: absolute;
+ width: 124px;
+ height: 124px;
+ left: 650px;
+ top: 70px;
+
+ background: url("./assets/Landing Page Images/Ellipse 117.png");
+}
diff --git a/src/pages/shop/sections/Banner/Caroussel.jsx b/src/pages/shop/sections/Banner/Caroussel.jsx
deleted file mode 100644
index 05414ef6..00000000
--- a/src/pages/shop/sections/Banner/Caroussel.jsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { useSwagList } from "@/hooks/Queries/shop/useSwagList";
-import { useEffect, useRef, useState } from "react";
-import { LazyLoadImage } from "react-lazy-load-image-component";
-import { Link } from "react-router-dom";
-
-function Carousel() {
- const [width, setWidth] = useState(0);
- const [selectedIndex, setSelectedIndex] = useState(0);
-
- const { data: swagList, isSuccess } = useSwagList();
- const carouselRef = useRef(null);
-
- useEffect(() => {
- if (carouselRef.current) {
- setWidth(carouselRef.current.offsetWidth + 10);
- }
- }, [carouselRef.current]);
-
- const scrollToIndex = (index) => {
- if (carouselRef.current) {
- carouselRef.current.scrollTo({
- left: index * width,
- behavior: "smooth",
- });
- setSelectedIndex(index);
- }
- };
-
- useEffect(() => {
- const interval = setInterval(() => {
- setSelectedIndex((prevIndex) => {
- const newIndex = (prevIndex + 1) % swagList.length;
- scrollToIndex(newIndex);
- return newIndex;
- });
- }, 1000000); // Autoplay every 10 seconds
-
- return () => clearInterval(interval);
- }, [width, swagList]);
-
- return (
- <>
-
-
-
- {isSuccess &&
- swagList?.map(({ image, name, id }) => (
-
-
-
- ))}
-
-
-
-
-
- SpaceYaTech Hoodies
-
-
- Buy out most stylish tech themed items
-
-
From KES 2,600
-
- Shop Now
-
-
- {swagList?.map((_, index) => (
- scrollToIndex(index)}
- />
- ))}
-
-
- >
- );
-}
-
-export default Carousel;
diff --git a/src/utilities/formatPrice.jsx b/src/utilities/formatPrice.jsx
new file mode 100644
index 00000000..924da6b6
--- /dev/null
+++ b/src/utilities/formatPrice.jsx
@@ -0,0 +1,6 @@
+const formatPrice = (price) =>
+ new Intl.NumberFormat("en-US", {
+ minimumFractionDigits: 0,
+ maximumFractionDigits: 0,
+ }).format(price);
+export default formatPrice;
From 955b0a2b2ea3abf629d4cea3306fc79eade5df7f Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 13:28:25 +0300
Subject: [PATCH 31/38] popular prods
---
.../shop/sections/PopularItemsSection.jsx | 92 +++++++++++--------
1 file changed, 56 insertions(+), 36 deletions(-)
diff --git a/src/pages/shop/sections/PopularItemsSection.jsx b/src/pages/shop/sections/PopularItemsSection.jsx
index 13704327..82690122 100644
--- a/src/pages/shop/sections/PopularItemsSection.jsx
+++ b/src/pages/shop/sections/PopularItemsSection.jsx
@@ -1,6 +1,8 @@
+import { CiShoppingTag } from "react-icons/ci";
+import { LazyLoadImage } from "react-lazy-load-image-component";
import { useNavigate } from "react-router-dom";
import { useSwagList } from "../../../hooks/Queries/shop/useSwagList";
-import { LazyLoadImage } from "react-lazy-load-image-component";
+import formatPrice from "../../../utilities/formatPrice";
function PopularItemsSection() {
const navigate = useNavigate();
@@ -8,46 +10,64 @@ function PopularItemsSection() {
const { data: products, isPending, isError, isSuccess } = useSwagList();
return (
-
-
- Popular items from SpaceYaTech
-
-
+
+
+
+
+ Similar Products
+
+
+
+
+ Products similar to the one above
+
+
{products
?.slice(0, 8)
- .map(
- ({ available, category, description, id, name, image, price }) => {
- return (
-
navigate(`/shop/item/${id}`)}
- >
-
-
-
-
-
-
-
- {name}
-
-
- {price}
-
+ .map(({ stock, category, description, id, name, image, price }) => (
+
navigate(`/shop/item/${id}`)}
+ >
+
+
+
+
+
+
+
+ {name}
+
+
+ {stock ? (
+
+ {stock} {stock === 1 ? "item" : "items"} left
+
+ ) : (
+
+ Out of stock
+
+ )}
+
+
+ KES {formatPrice(price)}
+
- );
- }
- )}
+
+
+ ))}
);
From 347f343c4d1f4d47fe2d77c9c36e3c2adba781f6 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 13:31:32 +0300
Subject: [PATCH 32/38] carousal featured prods
---
src/pages/shop/sections/Banner/Carousal.jsx | 102 ++++++++++---------
src/pages/shop/sections/FeaturedProducts.jsx | 55 ++--------
2 files changed, 63 insertions(+), 94 deletions(-)
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index dd06086d..05414ef6 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -1,60 +1,61 @@
-import { useState, useCallback, useEffect } from "react";
-import banner from "../../../../assets/images/shop-page/shop-banner.jpg";
-import Autoplay from "embla-carousel-autoplay";
-import useEmblaCarousel from "embla-carousel-react";
-import "./banner.css";
+import { useSwagList } from "@/hooks/Queries/shop/useSwagList";
+import { useEffect, useRef, useState } from "react";
import { LazyLoadImage } from "react-lazy-load-image-component";
import { Link } from "react-router-dom";
-const DotButton = ({ selected, onClick }) => (
-
-);
-
-export default function EmblaCarousel() {
- const [viewportRef, embla] = useEmblaCarousel({ loop: true }, [Autoplay()]);
-
+function Carousel() {
+ const [width, setWidth] = useState(0);
const [selectedIndex, setSelectedIndex] = useState(0);
- const [scrollSnaps, setScrollSnaps] = useState([]);
- const scrollTo = useCallback(
- (index) => embla && embla.scrollTo(index),
- [embla]
- );
+ const { data: swagList, isSuccess } = useSwagList();
+ const carouselRef = useRef(null);
- const onSelect = useCallback(() => {
- if (!embla) return;
- setSelectedIndex(embla.selectedScrollSnap());
- }, [embla, setSelectedIndex]);
+ useEffect(() => {
+ if (carouselRef.current) {
+ setWidth(carouselRef.current.offsetWidth + 10);
+ }
+ }, [carouselRef.current]);
+
+ const scrollToIndex = (index) => {
+ if (carouselRef.current) {
+ carouselRef.current.scrollTo({
+ left: index * width,
+ behavior: "smooth",
+ });
+ setSelectedIndex(index);
+ }
+ };
useEffect(() => {
- if (!embla) return;
- onSelect();
- setScrollSnaps(embla.scrollSnapList());
- embla.on("select", onSelect);
- }, [embla, setScrollSnaps, onSelect]);
+ const interval = setInterval(() => {
+ setSelectedIndex((prevIndex) => {
+ const newIndex = (prevIndex + 1) % swagList.length;
+ scrollToIndex(newIndex);
+ return newIndex;
+ });
+ }, 1000000); // Autoplay every 10 seconds
+
+ return () => clearInterval(interval);
+ }, [width, swagList]);
- const slides = Array.from(Array(5).keys());
return (
<>
-
+
-
- {slides.map((index) => (
-
-
-
- ))}
+
+ {isSuccess &&
+ swagList?.map(({ image, name, id }) => (
+
+
+
+ ))}
@@ -67,17 +68,18 @@ export default function EmblaCarousel() {
From KES 2,600
Shop Now
- {scrollSnaps.map((_, index) => (
- (
+ scrollTo(index)}
+ className={`cursor-pointer relative p-0 outline-none border-0 rounded-full h-[9px] w-[9px] ${index === selectedIndex ? " bg-green-dark" : "bg-white"}`}
+ type="button"
+ onClick={() => scrollToIndex(index)}
/>
))}
@@ -85,3 +87,5 @@ export default function EmblaCarousel() {
>
);
}
+
+export default Carousel;
diff --git a/src/pages/shop/sections/FeaturedProducts.jsx b/src/pages/shop/sections/FeaturedProducts.jsx
index ca075312..a7344b60 100644
--- a/src/pages/shop/sections/FeaturedProducts.jsx
+++ b/src/pages/shop/sections/FeaturedProducts.jsx
@@ -1,29 +1,10 @@
import { LandingWrapper } from "@/components";
import SectionWrapper from "@/components/shop/SectionWrapper";
-import useEmblaCarousel from "embla-carousel-react";
-import "./Banner/banner.css";
-import { useCallback, useEffect, useState } from "react";
import { useSwagList } from "@/hooks/Queries/shop/useSwagList";
import ProductCard from "@/components/shop/ProductCard";
const FeaturedProducts = () => {
const { data: swagList, isSuccess } = useSwagList();
- const [viewportRef, embla] = useEmblaCarousel({ loop: false });
-
- const [scrollProgress, setScrollProgress] = useState(0);
- const onScroll = useCallback((embla) => {
- const progress = Math.max(0, Math.min(1, embla.scrollProgress()));
- setScrollProgress(progress * 100);
- }, []);
- useEffect(() => {
- if (!embla) return;
-
- onScroll(embla);
- embla
- .on("reInit", onScroll)
- .on("scroll", onScroll)
- .on("slideFocus", onScroll);
- }, [embla, onScroll]);
return (
@@ -33,32 +14,16 @@ const FeaturedProducts = () => {
Our most popular products
-
-
-
- {isSuccess &&
- swagList?.map((product) => (
-
- ))}
- flex
-
-
-
-
-
+
+ {isSuccess &&
+ swagList?.map((product) => (
+
+ ))}
From 7c934206d46ebc56838ad8a2a774cf02b20a235c Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 13:35:23 +0300
Subject: [PATCH 33/38] update
---
src/pages/shop/sections/Banner/Carousal.jsx | 2 +-
src/pages/shop/sections/Banner/index.jsx | 2 +-
src/pages/shop/sections/FeaturedProducts.jsx | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index 05414ef6..a6f72c66 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -33,7 +33,7 @@ function Carousel() {
scrollToIndex(newIndex);
return newIndex;
});
- }, 1000000); // Autoplay every 10 seconds
+ }, 10000); // Autoplay every 10 seconds
return () => clearInterval(interval);
}, [width, swagList]);
diff --git a/src/pages/shop/sections/Banner/index.jsx b/src/pages/shop/sections/Banner/index.jsx
index b42f4663..d2d99318 100644
--- a/src/pages/shop/sections/Banner/index.jsx
+++ b/src/pages/shop/sections/Banner/index.jsx
@@ -1,4 +1,4 @@
-import Caroussel from "./Caroussel";
+import Caroussel from "./Carousal";
function Banner() {
return (
diff --git a/src/pages/shop/sections/FeaturedProducts.jsx b/src/pages/shop/sections/FeaturedProducts.jsx
index a7344b60..1b350abe 100644
--- a/src/pages/shop/sections/FeaturedProducts.jsx
+++ b/src/pages/shop/sections/FeaturedProducts.jsx
@@ -14,7 +14,7 @@ const FeaturedProducts = () => {
Our most popular products
-
+
{isSuccess &&
swagList?.map((product) => (
Date: Tue, 9 Jul 2024 13:38:39 +0300
Subject: [PATCH 34/38] fix link
---
src/pages/shop/sections/Banner/Carousal.jsx | 2 +-
src/pages/shop/sections/Banner/banner.css | 63 ---------------------
2 files changed, 1 insertion(+), 64 deletions(-)
delete mode 100644 src/pages/shop/sections/Banner/banner.css
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index a6f72c66..42584649 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -68,7 +68,7 @@ function Carousel() {
From KES 2,600
Shop Now
diff --git a/src/pages/shop/sections/Banner/banner.css b/src/pages/shop/sections/Banner/banner.css
deleted file mode 100644
index 1edc6c67..00000000
--- a/src/pages/shop/sections/Banner/banner.css
+++ /dev/null
@@ -1,63 +0,0 @@
-.embla {
- position: relative;
-}
-
-.embla__viewport {
- overflow: hidden;
- width: 100%;
-}
-
-.embla__viewport.is-draggable {
- cursor: move;
- cursor: grab;
-}
-
-.embla__viewport.is-dragging {
- cursor: grabbing;
-}
-
-.embla__container {
- display: flex;
- user-select: none;
- -webkit-touch-callout: none;
- -khtml-user-select: none;
- -webkit-tap-highlight-color: transparent;
- margin-left: -10px;
-}
-
-.embla__slide {
- position: relative;
- min-width: 100%;
- padding-left: 10px;
-}
-
-.embla__dot {
- cursor: pointer;
- position: relative;
- padding: 0;
- outline: 0;
- border: 0;
-}
-
-.embla__dot:after {
- background-color: #efefef;
- width: 100%;
- height: 4px;
- border-radius: 2px;
- content: "";
-}
-
-.embla__progress {
- position: relative;
- justify-self: flex-end;
- align-self: center;
- max-width: 90%;
- overflow: hidden;
-}
-.embla__progress__bar {
- position: absolute;
- width: 100%;
- top: 0;
- bottom: 0;
- left: -100%;
-}
From 391ffe2754af12d3e3ab7bf2e4829b7bb596785a Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 14:20:08 +0300
Subject: [PATCH 35/38] update css
---
src/index.css | 55 ++++++++++-----------
src/pages/shop/Homepage.jsx | 2 +-
src/pages/shop/sections/Banner/Carousal.jsx | 2 +-
src/pages/shop/sections/FilterSection.jsx | 4 --
4 files changed, 29 insertions(+), 34 deletions(-)
diff --git a/src/index.css b/src/index.css
index 62cb6b49..d85d1ecd 100644
--- a/src/index.css
+++ b/src/index.css
@@ -19,7 +19,7 @@
.scrollbar::-webkit-scrollbar {
width: 0;
height: 6px;
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
}
.scrollbar::-webkit-scrollbar-thumb {
@@ -29,36 +29,35 @@
}
.scrollbar::-webkit-scrollbar-track {
- background: #009975;
- -webkit-box-shadow: inset 0 0 6px #009975;
- border-top: 2px solid #e5efec;
- border-bottom: 2px solid #e5efec;
+ background: rgb(0 102 78 / 0.1);
+ -webkit-box-shadow: inset 0 0 6px rgb(0 102 78 / 0.1);
+ border-top: 2px solid #f3f4f5;
+ border-bottom: 2px solid #f3f4f5;
}
.hr-scrollbar::-webkit-scrollbar {
width: 0;
height: 6px;
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
}
.hr-scrollbar::-webkit-scrollbar-thumb {
background: #00664e;
-
border-radius: 12px;
}
.hr-scrollbar::-webkit-scrollbar-track {
- background: #009975;
- -webkit-box-shadow: inset 0 0 6px #009975;
- border-top: 2px solid #e5efec;
- border-bottom: 2px solid #e5efec;
+ background: rgb(0 102 78 / 0.1);
+ -webkit-box-shadow: inset 0 0 6px rgb(0 102 78 / 0.1);
+ border-top: 2px solid #f3f4f5;
+ border-bottom: 2px solid #f3f4f5;
}
@media (min-width: 768px) {
.scrollbar::-webkit-scrollbar {
width: 6px;
height: 0;
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
}
.scrollbar::-webkit-scrollbar-thumb {
@@ -68,15 +67,15 @@
}
.scrollbar::-webkit-scrollbar-track {
- background: #009975;
- -webkit-box-shadow: inset 0 0 6px #009975;
- border-left: 2px solid #e5efec;
- border-right: 2px solid #e5efec;
+ background: rgb(0 102 78 / 0.1);
+ -webkit-box-shadow: inset 0 0 6px rgb(0 102 78 / 0.1);
+ border-left: 2px solid #f3f4f5;
+ border-right: 2px solid #f3f4f5;
}
.hr-scrollbar::-webkit-scrollbar {
width: 6px;
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
}
.hr-scrollbar::-webkit-scrollbar-thumb {
@@ -86,10 +85,10 @@
}
.hr-scrollbar::-webkit-scrollbar-track {
- background: #009975;
- -webkit-box-shadow: inset 0 0 6px #009975;
- border-left: 2px solid #e5efec;
- border-right: 2px solid #e5efec;
+ background: rgb(0 102 78 / 0.1);
+ -webkit-box-shadow: inset 0 0 6px rgb(0 102 78 / 0.1);
+ border-left: 2px solid #f3f4f5;
+ border-right: 2px solid #f3f4f5;
}
}
@layer utilities {
@@ -102,7 +101,7 @@
left: 500.9px;
top: 66.87px;
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
opacity: 0.3;
filter: blur(15px);
transform: rotate(-75deg);
@@ -118,7 +117,7 @@
/* Primary/Green/800 */
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
opacity: 0.3;
filter: blur(15px);
transform: rotate(-75deg);
@@ -135,7 +134,7 @@
/* Primary/Green/800 */
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
opacity: 0.3;
filter: blur(15px);
transform: matrix(1, -0.03, -0.03, -1, 0, 0);
@@ -150,7 +149,7 @@
/* Primary/Green/800 */
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
opacity: 0.3;
filter: blur(15px);
transform: matrix(1, -0.03, -0.03, -1, 0, 0);
@@ -167,7 +166,7 @@
/* Primary/Green/800 */
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
opacity: 0.3;
filter: blur(15px);
transform: rotate(-75deg);
@@ -183,14 +182,14 @@
top: 60.25px;
/* Primary/Green/800 */
- background: #009975;
+ background: rgb(0 102 78 / 0.1);
opacity: 0.3;
filter: blur(15px);
transform: rotate(-75deg);
}
.bg-primary {
- background-color: #009975;
+ background-color: rgb(0 102 78 / 0.1);
}
/* Footer */
diff --git a/src/pages/shop/Homepage.jsx b/src/pages/shop/Homepage.jsx
index 9076e045..2fe5ab52 100644
--- a/src/pages/shop/Homepage.jsx
+++ b/src/pages/shop/Homepage.jsx
@@ -18,7 +18,7 @@ function Homepage() {
ogImageAlt="SpaceYaTech logo, social media handles, website URL, email, and more on a muted background."
siteName="SpaceYaTech Shop"
/>
-
+
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index 42584649..33f70ee2 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -68,7 +68,7 @@ function Carousel() {
From KES 2,600
Shop Now
diff --git a/src/pages/shop/sections/FilterSection.jsx b/src/pages/shop/sections/FilterSection.jsx
index 2f75cd7a..e6420695 100644
--- a/src/pages/shop/sections/FilterSection.jsx
+++ b/src/pages/shop/sections/FilterSection.jsx
@@ -1,8 +1,6 @@
import SearchInput from "@/components/shop/SearchInput";
import SectionWrapper from "@/components/shop/SectionWrapper";
import SortItems from "@/components/shop/SortItems";
-import { Menu } from "@headlessui/react";
-import { IoMenu } from "react-icons/io5";
import { Link, useParams } from "react-router-dom";
import { categories } from "../data";
@@ -33,8 +31,6 @@ const Categories = () => {
{categories.map((item, i) => (
))}
-
{" "}
-
);
};
From 9f87d9da64efca3044495ade7c5ce6cf4f53e852 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 14:20:25 +0300
Subject: [PATCH 36/38] rm unused packages
---
package.json | 3 ---
1 file changed, 3 deletions(-)
diff --git a/package.json b/package.json
index 633df16d..1743a34b 100644
--- a/package.json
+++ b/package.json
@@ -28,9 +28,6 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^2.30.0",
- "embla-carousel": "^8.1.5",
- "embla-carousel-autoplay": "^8.1.5",
- "embla-carousel-react": "^8.1.5",
"html-react-parser": "^5.0.6",
"lucide-react": "^0.395.0",
"million": "^3.0.2",
From cb4919156a83ea92b320d108a59e95112e4e4df1 Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 9 Jul 2024 14:21:41 +0300
Subject: [PATCH 37/38] update link
---
src/pages/shop/sections/Banner/Carousal.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/shop/sections/Banner/Carousal.jsx b/src/pages/shop/sections/Banner/Carousal.jsx
index 33f70ee2..bd1efa20 100644
--- a/src/pages/shop/sections/Banner/Carousal.jsx
+++ b/src/pages/shop/sections/Banner/Carousal.jsx
@@ -68,7 +68,7 @@ function Carousel() {
From KES 2,600
Shop Now
From 3ac97f05fa3e7f4d70383541d1ced8c2cf5fc40e Mon Sep 17 00:00:00 2001
From: Joe-Mwangi
Date: Tue, 16 Jul 2024 17:33:37 +0300
Subject: [PATCH 38/38] updated product section
---
src/pages/shop/sections/AllProducts.jsx | 5 +++--
src/pages/shop/sections/FeaturedProducts.jsx | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/pages/shop/sections/AllProducts.jsx b/src/pages/shop/sections/AllProducts.jsx
index 5cf6a61a..57f018de 100644
--- a/src/pages/shop/sections/AllProducts.jsx
+++ b/src/pages/shop/sections/AllProducts.jsx
@@ -2,9 +2,9 @@ import { useEffect, useState } from "react";
import { useSearchParams } from "react-router-dom";
import { useSwagList } from "../../../hooks/Queries/shop/useSwagList";
import SectionWrapper from "@/components/shop/SectionWrapper";
-import CartIcon from "@/components/shop/CartIcon";
import FilterSection from "./FilterSection";
import ProductCard from "@/components/shop/ProductCard";
+import ItemHeader from "./ItemHeader";
function AllProducts() {
const [products, setProducts] = useState([]);
@@ -40,7 +40,8 @@ function AllProducts() {
return (
<>
-
+ setOpen((prev) => !prev)} />
+
diff --git a/src/pages/shop/sections/FeaturedProducts.jsx b/src/pages/shop/sections/FeaturedProducts.jsx
index 1b350abe..0171a195 100644
--- a/src/pages/shop/sections/FeaturedProducts.jsx
+++ b/src/pages/shop/sections/FeaturedProducts.jsx
@@ -7,11 +7,11 @@ const FeaturedProducts = () => {
const { data: swagList, isSuccess } = useSwagList();
return (
-
+
- Our most popular products
+ New Products in the Inventory