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
911const 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 ;
0 commit comments