Skip to content

Commit dc54562

Browse files
Merge pull request #126 from akshat-chd/Home_edit
Fixed the home page
2 parents 0940b48 + 9b8cdb4 commit dc54562

File tree

4 files changed

+70
-98
lines changed

4 files changed

+70
-98
lines changed

src/components/Home/CardItem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const CardItem = (props) => {
66

77
const imageStyle = {
88
objectFit: 'cover',
9-
width: '100%',
10-
height: '100%',
9+
width: '90%',
10+
height: '90%',
1111
};
1212

1313
const cardStyle = {

src/pages/home/Cards.js

Lines changed: 61 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,65 @@
1-
import React from 'react'
2-
import CardItem from '../../components/Home/CardItem'
3-
import Slider from 'react-slick';
4-
import "../../styles/pages/Home/Cards.css"
5-
import Wordle from "../../assets/games/Wordle/wordlejpg.png"
6-
import flagGame from "../../assets/games/flag guess/flagger.png"
7-
import magicSquare from "../../assets/numberblocks.png"
1+
import React from "react";
2+
import Slider from "react-slick";
3+
import "../../styles/pages/Home/Cards.css";
4+
5+
// ✅ this is your central data file
6+
import { activities, games } from "../../data/content";
7+
8+
// ✅ your existing card
9+
import CardItem from "../../components/Home/CardItem";
810

911
const Cards = () => {
10-
// Slick settings for the carousel
11-
const settings = {
12-
dots: true,
13-
infinite: true,
14-
speed: 500,
15-
slidesToShow: 3, // Number of cards to show at once
16-
slidesToScroll: 1,
17-
responsive: [
18-
{
19-
breakpoint: 1024,
20-
settings: {
21-
slidesToShow: 2,
22-
slidesToScroll: 1,
23-
infinite: true,
24-
dots: true
25-
}
26-
},
27-
{
28-
breakpoint: 600,
29-
settings: {
30-
slidesToShow: 1,
31-
slidesToScroll: 1,
32-
}
33-
}
34-
]
35-
};
12+
const settings = {
13+
dots: true,
14+
infinite: true,
15+
speed: 500,
16+
slidesToShow: 3,
17+
slidesToScroll: 1,
18+
responsive: [
19+
{
20+
breakpoint: 1024,
21+
settings: { slidesToShow: 2, slidesToScroll: 1, dots: true },
22+
},
23+
{
24+
breakpoint: 600,
25+
settings: { slidesToShow: 1, slidesToScroll: 1 },
26+
},
27+
],
28+
};
29+
30+
// ✅ combine all games + activities from your data file
31+
const allItems = [
32+
...games.map((g) => ({
33+
src: g.icon,
34+
text: g.description,
35+
title: g.title,
36+
path: `/games/${g.urlTerm}`,
37+
})),
38+
...activities.map((a) => ({
39+
src: a.icon,
40+
text: a.description,
41+
title: a.title,
42+
path: `/activities/${a.urlTerm}`,
43+
})),
44+
];
3645

37-
return (
38-
<div className='container'>
39-
<Slider {...settings}>
40-
<CardItem
41-
src={Wordle}
42-
text="Wordle Game"
43-
label="Puzzle"
44-
path='/games/Wordle'
45-
title='Wordle' />
46-
<CardItem
47-
src={"https://img.freepik.com/free-vector/detailed-click-collect-sign_52683-53160.jpg?size=626&ext=jpg"}
48-
text="Jitter Click Game"
49-
label="Puzzle"
50-
path='/games/jitter-game'
51-
title='Jitter' />
52-
<CardItem
53-
src={magicSquare}
54-
text="The Magic Squares Game"
55-
label="Puzzle"
56-
path='/games/magicsquares'
57-
title='MagicSquare' />
58-
<CardItem
59-
src={"https://cdn-icons-png.flaticon.com/512/2076/2076261.png"}
60-
text="TicTacToe with a twist"
61-
label="Puzzle"
62-
path='/games/tic-tac-toe'
63-
title='tic-tac-toe' />
64-
<CardItem
65-
src={flagGame}
66-
text="Learn Geography Fun Way"
67-
label="Guess The Flag"
68-
path='/games/GuessTheFlag'
69-
title='Guess The Flag' />
70-
<CardItem
71-
src={"https://cdn-icons-png.flaticon.com/512/2541/2541991.png"}
72-
text="Get random quotes"
73-
label="Random Quotes"
74-
path='/activities/random-quotes'
75-
title='Random Quotes' />
76-
<CardItem
77-
src={"https://aws.astrotalk.com/assets/images/wheel_of_fortune.webp"}
78-
text="Know your fortune"
79-
label="Fortune Cards"
80-
path='/activities/get-your-fortune'
81-
title='Fortune Cards' />
82-
<CardItem
83-
src={"https://img.freepik.com/free-photo/marketing-research-concept-with-magnifying-glass-wooden-cubes-red-table-flat-lay_176474-9480.jpg?w=826&t=st=1698234200~exp=1698234800~hmac=06d4ff5d91bc832f3c7a656d2b3a1a792a66a1eab8161ae9086e29a67599154f"}
84-
text="Get any Definition"
85-
label="Search Words"
86-
path='/activities/search-any-word'
87-
title='Search Words' />
88-
</Slider>
89-
</div>
90-
)
91-
}
46+
return (
47+
<div className="container">
48+
<Slider {...settings}>
49+
{allItems.map((item) => (
50+
<div key={item.path} style={{ display: "flex", justifyContent: "center" }}>
51+
<CardItem
52+
src={item.src}
53+
text={item.text}
54+
label={item.title}
55+
path={item.path}
56+
title={item.title}
57+
/>
58+
</div>
59+
))}
60+
</Slider>
61+
</div>
62+
);
63+
};
9264

93-
export default Cards
65+
export default Cards;

src/styles/pages/Home/CardItem.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.card-image{
22
width: 266px;
3-
height: 35vh;
3+
height: 36vh;
44
display: flex;
55
justify-content: center;
66
overflow: hidden;
77
/* padding: 0 !important; */
88
}
99
.card-body{
10-
width: 266px;
11-
height: 22vh;
10+
width: 290px;
11+
height: 28vh;
1212
display: flex;
1313
flex-direction: column;
1414
justify-content: center;

src/styles/pages/Home/Cards.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ h1 {
7878
bottom: 0;
7979
left: 0;
8080
display: block;
81-
width: 100%;
82-
max-width: 100%;
83-
height: 100%;
84-
max-height: 100%;
81+
width: 80%;
82+
max-width: 50%;
83+
height: 80%;
84+
max-height: 50%;
8585
object-fit: cover;
8686
transition: all 0.2s linear;
8787
}

0 commit comments

Comments
 (0)