Skip to content

Commit 34024fa

Browse files
Merge pull request #40 from bhagirathpaliyal/UI
added HoverEffect & BackgroundBeamsWithCollision
2 parents f4ea9e4 + 01fae46 commit 34024fa

File tree

7 files changed

+422
-52
lines changed

7 files changed

+422
-52
lines changed

package-lock.json

Lines changed: 102 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"class-variance-authority": "^0.7.1",
2222
"clsx": "^2.1.1",
2323
"firebase": "^10.10.0",
24+
"framer-motion": "^12.6.3",
2425
"lucide-react": "^0.483.0",
26+
"motion": "^12.7.4",
2527
"react": "^18.2.0",
2628
"react-dom": "^18.2.0",
2729
"react-icons": "^5.0.1",

src/components/Home/H_section1.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Link } from "react-router-dom";
22
import { ReactTyped, Typed } from "react-typed";
3-
3+
import { BackgroundBeamsWithCollision } from "@/components/ui/background-beams-with-collision";
44
function H_section1() {
55
return (
6-
<div id="section1" className=" bg-hero-image h-[100vh] bg-cover bg-no-repeat bg-bottom flex flex-col justify-around items-center text-black ">
6+
<BackgroundBeamsWithCollision>
7+
<div id="section1" className=" bg-hero-image h-[100vh] w-full bg-cover bg-no-repeat bg-bottom flex flex-col justify-around items-center text-black ">
78

89

910
<div className="text-[20px] md:text-[24px] text-center">
@@ -35,6 +36,7 @@ function H_section1() {
3536
</div>
3637

3738
</div>
39+
</BackgroundBeamsWithCollision>
3840
);
3941
}
4042

src/components/Home/H_section2.jsx

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import man from "./../../assets/man.jpg";
33
import women from "./../../assets/women.jpg";
44
import { useEffect, useState } from "react";
55
import { Button } from "@mui/material";
6+
import { HoverEffect } from "../ui/card-hover-effect";
67

78
function H_section2() {
89
const [dataa, setdataa] = useState([
@@ -11,46 +12,38 @@ function H_section2() {
1112
"Man",
1213
"Women",
1314
]);
15+
1416
useEffect(() => {
1517
fetch("https://fakestoreapi.com/products/categories")
16-
.then((res) => {
17-
return res.json();
18-
})
19-
.then((data) => {
20-
setdataa(data);
21-
});
18+
.then((res) => res.json())
19+
.then((data) => setdataa(data));
2220
}, []);
2321

22+
const hoverItems = dataa.map((data, index) => {
23+
const route =
24+
data === "men's clothing"
25+
? "/Products/Men"
26+
: data === "women's clothing"
27+
? "/Products/Women"
28+
: `/Products/${data}`;
29+
const image =
30+
data === "men's clothing" || data === "Man" ? man : women;
31+
32+
return {
33+
title: data,
34+
image: image,
35+
link: route,
36+
};
37+
});
38+
2439
return (
2540
<div
2641
id="section2"
27-
className="bg-primary flex flex-col gap-[50px] items-center justify-center text-white p-[50px]"
42+
className="bg-primary flex flex-col items-center justify-center text-white p-[50px]"
2843
>
29-
<div className="text-[30px] md:text-[40px] ">Our collection</div>
30-
<div className="flex w-[100%] justify-evenly flex-wrap">
31-
32-
{dataa?.map((data, index) => (
33-
<Link
34-
key={index}
35-
to={
36-
data === "men's clothing"
37-
? "/Products/Men"
38-
: data === "women's clothing"
39-
? "/Products/Women"
40-
: `/Products/${data}`
41-
}
42-
>
43-
<div className="max-w-[200px] pb-[20px] flex flex-col items-center gap-[10px] ">
44-
<div className="w-[100%] rounded-[10px] overflow-hidden">
45-
<img src={man} alt="image" />
46-
</div>
47-
<div>
48-
<h2>{data}</h2>
49-
</div>
50-
</div>
51-
</Link>
52-
))}
53-
</div>
44+
<div className="text-[30px] md:text-[40px]">Our collection</div>
45+
46+
<HoverEffect items={hoverItems} />
5447

5548
<Link to={"/Products/AllProducts"}>
5649
<Button color="inherit">See All Products</Button>

0 commit comments

Comments
 (0)