Skip to content

Commit

Permalink
Merge pull request #81 from sp9324/master
Browse files Browse the repository at this point in the history
added slider for games
  • Loading branch information
ken1000minus7 authored Oct 5, 2024
2 parents 57b40e6 + 6b4488c commit cbe9a11
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 131 deletions.
61 changes: 61 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"react-router": "^6.17.0",
"react-router-dom": "^6.17.0",
"react-scripts": "5.0.1",
"react-slick": "^0.30.2",
"slick-carousel": "^1.8.1",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import {Games} from "./pages/Games";
import {Activities} from "./pages/Activities";
import {activities, games} from "./data/content";
import {Navbar} from './components/common/Navbar';
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";


function App() {
return (
Expand Down
7 changes: 6 additions & 1 deletion src/components/Home/CardItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ const CardItem = (props) => {
height: '100%',
};

const cardStyle = {
width: '500px',
margin: '20px'
};

return (
<div className="col-md-4 col-sm-6 mb-4">
<div class="card container-fluid">
<div class="card container-fluid" style={cardStyle}>
<div className="card-image">
<img
className="card-img-top"
Expand Down
37 changes: 31 additions & 6 deletions src/pages/home/Cards.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
import React from 'react'
import CardItem from '../../components/Home/CardItem'
// import "../../styles/pages/Home/Cards.css"
import Slider from 'react-slick';
import "../../styles/pages/Home/Cards.css"
import Wordle from "../../assets/games/Wordle/wordlejpg.png"
import flagGame from "../../assets/games/flag guess/flagger.png"
import magicSquare from "../../assets/numberblocks.png"

const Cards = () => {
return (
// Slick settings for the carousel
const settings = {
dots: true,
infinite: true,
speed: 500,
slidesToShow: 3, // Number of cards to show at once
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
}
}
]
};

return (
<div className='container'>
<div className='row justify-content-center'>

<Slider {...settings}>
<CardItem
src={Wordle}
text="Wordle Game"
Expand Down Expand Up @@ -59,8 +85,7 @@ const Cards = () => {
label="Search Words"
path='/activities/search-any-word'
title='Search Words' />

</div>
</Slider>
</div>
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/styles/pages/Home/CardItem.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.card-image{
width: 100%;
width: 266px;
height: 35vh;
display: flex;
justify-content: center;
overflow: hidden;
/* padding: 0 !important; */
}
.card-body{
width: 100%;
width: 266px;
height: 22vh;
display: flex;
flex-direction: column;
Expand Down
Loading

0 comments on commit cbe9a11

Please sign in to comment.