Skip to content

Commit 7154dae

Browse files
committed
restructure categories
- Add new sections & it's images in Dummy Data file - Redesign categories items rendering in home page
1 parent 8e72017 commit 7154dae

File tree

12 files changed

+90
-118
lines changed

12 files changed

+90
-118
lines changed

client/src/Data/categoriesData.js

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,68 @@
1-
import OfferFirstSlide from '../images/2.png'
2-
import OfferSecondSlide from '../images/2.png'
3-
import OfferThirdSlide from '../images/2.png'
1+
import Mobiles from '../images/mobiles.jpg'
2+
import accessories from '../images/airpod.png'
3+
import appliances from '../images/homeAppliances.jpg'
4+
import Men from '../images/menWear.jpg'
5+
import Grocery from '../images/grocery.jpg'
6+
import Beauty from '../images/beauty.jpg'
7+
import Baby from '../images/baby.jpg'
8+
import Vega from '../images/veg.jpg'
9+
import KidsWear from '../images/kidsWear.jpg'
410

511
export const categories = [
612
{
713
id: 1,
8-
img: OfferFirstSlide,
9-
title: "MOBILE",
14+
img: Mobiles,
15+
title: "mobile",
1016
category: "mobile",
1117
},
1218
{
1319
id: 2,
14-
img: OfferSecondSlide,
15-
title: "Accessories",
20+
img: accessories,
21+
title: "accessories",
1622
category: "accessories",
1723
},
1824
{
1925
id: 3,
20-
img: OfferThirdSlide,
21-
title: "HOME APPLIANCE",
26+
img: appliances,
27+
title: "appliances",
2228
category: "appliances",
23-
}
29+
},
30+
{
31+
id: 4,
32+
img: Men,
33+
title: "Men",
34+
category: "Men",
35+
},
36+
{
37+
id: 5,
38+
img: Grocery,
39+
title: "grocery",
40+
category: "grocery",
41+
},
42+
{
43+
id: 6,
44+
img: Beauty,
45+
title: "beauty",
46+
category: "beauty",
47+
},
48+
{
49+
id: 7,
50+
img: Baby,
51+
title: "baby",
52+
category: "baby",
53+
},
54+
{
55+
id: 8,
56+
img: Vega,
57+
title: "fruits & veg",
58+
category: "fruits & veg",
59+
},
60+
{
61+
id: 9,
62+
img: KidsWear,
63+
title: "Kids Wear",
64+
category: "Kids Wear",
65+
},
66+
67+
2468
]

client/src/components/CategoryItem.jsx

Lines changed: 25 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,49 @@ import styled from 'styled-components'
88
import { mobile } from '../responsive'
99

1010
// Styling...
11-
const CategoryTitle = styled.h1`
12-
color: white;
13-
margin-bottom: 20px;
14-
${mobile({fontSize:'22px'})}
15-
`
16-
const Button = styled.button`
17-
padding: 10px;
18-
border: 1px solid white;
19-
cursor: pointer;
20-
background-color: transparent;
21-
color: white;
22-
font-weight: 700;
23-
transition: all 0.5s ease;
24-
&:hover{
25-
transform: scale(1.2);
26-
box-shadow: rgba(0, 0, 0, 0.25) 0px 14px 28px, rgba(0, 0, 0, 0.22) 0px 10px 10px;
27-
transform: rotate(0deg);
28-
border-color: white;
29-
}
30-
&:active{
31-
color:black;
32-
background-color: aqua;
33-
border: none;
34-
border-radius: 19px;
35-
}
36-
`
3711
const Container = styled.div`
3812
flex: 1;
39-
margin: 5px;
40-
position: relative;
4113
width: 25%;
4214
height: 25%;
43-
${mobile({height: '100%',width: '100%'})}
44-
45-
&:hover ${CategoryTitle} {
46-
transform: scale(1.5);
47-
box-shadow: rgba(0, 0, 0, 0.25) 0px 14px 28px, rgba(0, 0, 0, 0.22) 0px 10px 10px;
48-
background-color: rgba(0,0,0,0.18);
49-
transition: all 1s ease;
50-
${mobile({transform:'scale(1.1)'})}
51-
52-
}
53-
&:hover {
54-
transform: scale(1.2);
55-
transition: all 1s ease;
56-
57-
}
58-
&:hover ${Button}{
59-
margin-top: 60px;
60-
61-
}
62-
63-
64-
15+
${mobile({ height: '100%', width: '100%' })};
16+
align-items: center;
6517
`
6618
const CategoryImage = styled.img`
67-
width: 100%;
68-
height: 100%;
19+
width: 100px;
20+
height: 100px;
21+
border-radius: 50%;
6922
object-fit: cover;
70-
71-
23+
display: flex;
24+
margin-bottom: 10px;
7225
`
7326
const CategoryInfo = styled.div`
74-
width: 100%;
75-
height: 100%;
76-
top:0;
77-
left: 0;
78-
position: absolute;
27+
display: flex;
28+
flex-direction: column;
29+
align-items: center;
30+
`
31+
const CategoryTitle = styled.h1`
32+
font-size: 20px;
33+
font-weight: bold;
34+
35+
`
36+
const CategoryContainer = styled.div`
7937
display: flex;
8038
align-items: center;
81-
justify-content: center;
8239
flex-direction: column;
83-
84-
8540
`
8641

8742
// Category Item react functional component...
8843
export default function CategoryItem({ section }) {
8944
return (
9045
<Container>
91-
<Link to={`/products/${section.category}`}>
92-
<CategoryImage src={section.img} />
93-
<CategoryInfo>
94-
<CategoryTitle>{section.title}</CategoryTitle>
95-
<Button>SHOP NOW</Button>
96-
</CategoryInfo>
46+
<Link to={`/products/${section.category}`} style={{ color: 'inherit', backgroundColor: 'inherit', textDecoration: 'none' }} >
47+
<CategoryContainer>
48+
49+
<CategoryImage src={section.img} />
50+
<CategoryInfo>
51+
<CategoryTitle>{section.title}</CategoryTitle>
52+
</CategoryInfo>
53+
</CategoryContainer>
9754
</Link>
9855
</Container>
9956
)

client/src/components/Slider.jsx

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {mobile} from '../responsive'
2525
const Container = styled.div`
2626
display: flex;
2727
width: 100%;
28-
height: 100vh;
28+
height: 350px;
2929
background-color:white;
3030
overflow: hidden;
3131
position: relative;
@@ -60,7 +60,7 @@ const Slide = styled.div`
6060
display:flex;
6161
align-items: center;
6262
width: 100vw;
63-
height: 100vh;
63+
6464
background-color: ${props => props.bg};
6565
transition: all 1s ease;
6666
@@ -115,17 +115,20 @@ const SliderImageContainer = styled.div`
115115
height: 100%;
116116
`
117117
const SliderImage = styled.img`
118-
height: 88%;
118+
height: 100%;
119+
margin-left: 80px;
120+
margin-bottom: 25px;
119121
`
120122
const SliderInfoContainer = styled.div`
121-
flex: 1;
122-
padding: 45px;
123+
flex: 2;
124+
display: flex;
125+
flex-direction: column;
123126
`
124127
const SlideTitle = styled.h1`
125-
font-size: 80px;
128+
font-size: 65px;
126129
`
127130
const SlideDescription = styled.p`
128-
margin: 50px 0;
131+
margin: 10px 0;
129132
font-size: 20px;
130133
letter-spacing: 4px;
131134
font-weight: 500;
@@ -135,39 +138,7 @@ const SlideButton = styled.button`
135138
background-color: transparent;
136139
cursor: pointer ;
137140
padding: 15px;
138-
139-
animation: ${props => props.myElementIsVisible === true && 'shake 0.82s cubic-bezier(.36,.07,.19,.97) both'};
140-
transform: ${props => props.myElementIsVisible === true && 'translate3d(0, 0, 0)'};
141-
backface-visibility: ${props => props.myElementIsVisible === true && 'hidden'};
142-
perspective: ${props => props.myElementIsVisible === true && '1000px'};
143-
144-
@keyframes shake {
145-
10%, 90% {
146-
transform: translate3d(-1px, 0, 0);
147-
}
148-
149-
20%, 80% {
150-
transform: translate3d(2px, 0, 0);
151-
}
152-
30%, 50%, 70% {
153-
transform: translate3d(-4px, 0, 0);
154-
}
155-
40% , 60% {
156-
transform: translate3d(4px, 0, 0);
157-
}
158-
}
159-
&:hover{
160-
transform: scale(1.2);
161-
border: 2px solid white;
162-
}
163-
&:active{
164-
transform: scale(1);
165-
background-color: aqua;
166-
color: black;
167-
border: none;
168-
border-radius: 19px;
169-
transition: all 0.5s ease;
170-
}
141+
width: 15%;
171142
172143
`
173144
export default function Slider() {

client/src/images/airpod.jpg

2.25 KB
Loading

client/src/images/airpod.png

3.74 KB
Loading

client/src/images/baby.jpg

10.9 KB
Loading

client/src/images/beauty.jpg

9.87 KB
Loading

client/src/images/grocery.jpg

20.1 KB
Loading

client/src/images/kidsWear.jpg

5.96 KB
Loading

client/src/images/menWear.jpg

6.74 KB
Loading

0 commit comments

Comments
 (0)