Skip to content

Commit 240a521

Browse files
Aksh-Bansal-devSamy-33
authored andcommitted
feat(ui): add clubs carousel
1 parent 49c81ca commit 240a521

File tree

11 files changed

+145
-2
lines changed

11 files changed

+145
-2
lines changed

ui/package-lock.json

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

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"history": "^5.3.0",
1717
"react": "^18.0.0",
1818
"react-dom": "^18.0.0",
19+
"react-multi-carousel": "^2.8.2",
1920
"react-responsive-carousel": "^3.2.23",
2021
"react-router-dom": "^6.3.0",
2122
"react-toastify": "^9.0.5"
6.8 KB
Loading

ui/src/assets/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
export const logo = new URL('./images/logo.svg', import.meta.url).href;
33
export const dummyNewsImg = new URL('./images/dummy_news.jpg', import.meta.url)
44
.href;
5+
export const dummyClubLogo = new URL(
6+
'./images/dummy-club-logo.png',
7+
import.meta.url
8+
).href;
59
export const loginArrow = new URL('./images/login-arrow.svg', import.meta.url)
610
.href;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import styles from './styles.module.css';
2+
import Carousel from 'react-multi-carousel';
3+
import 'react-multi-carousel/lib/styles.css';
4+
import {dummyClubLogo} from '../../assets';
5+
6+
const data = [
7+
{
8+
name: 'TPC',
9+
category: 'Technical',
10+
logoUrl: dummyClubLogo,
11+
},
12+
{
13+
name: 'Jazbaat',
14+
category: 'Cultural',
15+
logoUrl: dummyClubLogo,
16+
},
17+
{
18+
name: 'Basketball',
19+
category: 'Sports',
20+
logoUrl: dummyClubLogo,
21+
},
22+
{
23+
name: 'Saaz',
24+
category: 'Cultural',
25+
logoUrl: dummyClubLogo,
26+
},
27+
{
28+
name: 'Badminton',
29+
category: 'Sports',
30+
logoUrl: dummyClubLogo,
31+
},
32+
];
33+
34+
export const ClubsCarousel: React.FC = () => {
35+
const responsive = {
36+
desktop: {
37+
breakpoint: {max: 5000, min: 1024},
38+
items: 4,
39+
},
40+
tablet: {
41+
breakpoint: {max: 1024, min: 800},
42+
items: 2,
43+
},
44+
mobile: {
45+
breakpoint: {max: 800, min: 0},
46+
items: 1,
47+
},
48+
};
49+
return (
50+
<div className={styles.container}>
51+
<div className={styles.heading}>Clubs</div>
52+
<Carousel responsive={responsive} className={styles.carousel}>
53+
{data.map((club, i) => (
54+
<div key={i} className={styles.card}>
55+
<img src={club.logoUrl} alt="club" />
56+
<div>
57+
<div className={styles.name}>{club.name}</div>
58+
<div className={styles.category}>{club.category}</div>
59+
</div>
60+
</div>
61+
))}
62+
</Carousel>
63+
</div>
64+
);
65+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.container {
2+
margin-top: 8vh;
3+
}
4+
5+
.heading {
6+
background-color: var(--primary-color);
7+
width: fit-content;
8+
padding: 1.5vh 3vh;
9+
border-radius: 15px;
10+
color: var(--secondary-color);
11+
font-weight: 600;
12+
margin-bottom: 2vh;
13+
margin-left: 3vw;
14+
}
15+
16+
.carousel {
17+
padding: 4vh 3vw;
18+
width: 97%;
19+
}
20+
21+
.card {
22+
background-color: var(--off-white);
23+
width: 235px;
24+
height: 120px;
25+
transition: scale 1s;
26+
box-shadow: 5.57653px 5.57653px 22.3061px rgba(0, 0, 0, 0.25);
27+
border-radius: 20px;
28+
padding: 3vh;
29+
cursor: pointer;
30+
display: flex;
31+
align-items: center;
32+
justify-content: space-between;
33+
}
34+
35+
.card:hover {
36+
transform: scale(1.1);
37+
background-color: var(--secondary-color);
38+
}
39+
40+
.card img {
41+
width: 72px;
42+
}
43+
44+
.name {
45+
color: var(--primary-text);
46+
font-size: 1.1rem;
47+
font-weight: 600;
48+
}
49+
50+
.category {
51+
color: var(--secondary-text);
52+
font-size: 0.9rem;
53+
}

ui/src/components/NewsCarousel/styles.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
background-size: cover;
77
background-repeat: no-repeat;
88
display: flex;
9+
margin: 0 4vw;
910
}
1011
.leftContainer {
1112
width: 30%;

ui/src/components/TopBar/styles.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
padding: 1vh;
1111
display: flex;
1212
align-items: center;
13+
margin-right: 5vh;
1314
}
1415

1516
.profileInfoContainer img {

ui/src/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ body {
55
font-family: 'Inter', sans-serif;
66
-webkit-font-smoothing: antialiased;
77
-moz-osx-font-smoothing: grayscale;
8+
overflow-x: hidden;
89
}
910

1011
* {
@@ -20,4 +21,6 @@ body {
2021

2122
--primary-color: #d81f26;
2223
--secondary-color: white;
24+
25+
--off-white: #f6f7fe;
2326
}

ui/src/pages/Home/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {ClubsCarousel} from '../../components/ClubsCarousel';
12
import {NewsCarousel} from '../../components/NewsCarousel';
23
import {TopBar} from '../../components/TopBar';
34
import styles from './styles.module.css';
@@ -9,6 +10,7 @@ export const Home: React.FC = () => {
910
<div className={styles.mainContent}>
1011
<TopBar />
1112
<NewsCarousel />
13+
<ClubsCarousel />
1214
</div>
1315
</div>
1416
);

ui/src/pages/Home/styles.module.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.container {
2-
height: 100vh;
2+
min-height: 100vh;
33
width: 100vw;
44
background-color: #f4f5f7;
55
display: flex;
@@ -10,7 +10,6 @@
1010
}
1111
.mainContent {
1212
width: 82%;
13-
padding: 0 4vw;
1413
}
1514

1615
@media only screen and (max-width: 700px) {

0 commit comments

Comments
 (0)