Skip to content

Commit

Permalink
Merge pull request #779 from Edwinliby/old-dev
Browse files Browse the repository at this point in the history
slider kkemlearningfest
  • Loading branch information
AswinAsok authored Sep 10, 2023
2 parents 753c2a1 + e92030f commit a5302a5
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 59 deletions.
49 changes: 7 additions & 42 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"react-scripts": "5.0.1",
"react-tabs": "^5.1.0",
"react-time-ago": "^7.2.1",
"swiper": "^8.4.7",
"swiper": "^10.1.0",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/KKEMLearningFest/KKEMLearningFest.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
/* overflow: hidden; */
}

.kkemLearningFestFooter{
Expand Down
43 changes: 37 additions & 6 deletions src/Pages/KKEMLearningFest/components/Cards/Cards.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
import React from "react";
import React, { useRef, useEffect } from "react";
import mario from "../../assets/mario.webp";
import styles from "./Cards.module.css";
import princess from "../../assets/Princess.webp";
import luigi from "../../assets/Luigi.webp";

export default function Cards() {
const slider = useRef(null);

useEffect(() => {
const sliderElement = slider.current;
let isDown = false;
let startX;
let scrollLeft;

sliderElement.addEventListener('mousedown', (e) => {
isDown = true;
sliderElement.classList.add('active');
startX = e.pageX - sliderElement.offsetLeft;
scrollLeft = sliderElement.scrollLeft;
});

sliderElement.addEventListener('mouseleave', () => {
isDown = false;
sliderElement.classList.remove('active');
});

sliderElement.addEventListener('mouseup', () => {
isDown = false;
sliderElement.classList.remove('active');
});

sliderElement.addEventListener('mousemove', (e) => {
if (!isDown) return;
e.preventDefault();
const x = e.pageX - sliderElement.offsetLeft;
const walk = (x - startX) * 3;
sliderElement.scrollLeft = scrollLeft - walk;
});
}, []);

return (
<div className={styles.carosel}>
<div className={styles.mainConatiner}>
<div className={styles.cardsConatiner}>
<div ref={slider} className={styles.carosel}>
<div className={styles.cardsConatiner}>
<div className={styles.card}>
<img src={mario} alt="" />
<div className={styles.cardConatiner}>
Expand Down Expand Up @@ -93,8 +126,6 @@ export default function Cards() {
</div>
</div>
</div>
</div>

</div>
);
}
24 changes: 20 additions & 4 deletions src/Pages/KKEMLearningFest/components/Cards/Cards.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@

.carosel {
width: 100%;
display: grid;
place-content: center;
/* overflow: hidden; */
display: flex;
position: relative;
gap: 2rem;
padding: 0 13rem;
overflow-x: scroll;
}

.carosel::-webkit-scrollbar {
display: none;
}

.cardsConatiner {
Expand Down Expand Up @@ -156,7 +161,18 @@
animation: fade-down 3s ease;
}

@media(width<1025px){
.carosel{
padding: 0 5rem;
}
}

@media (width<820px) {
.carosel {
padding: 0;
gap: 0rem;
}

.cardsConatiner {
margin: 1.5rem;
justify-content: center;
Expand All @@ -169,7 +185,7 @@
}

.cardConatiner {
width: fit-content ;
width: fit-content;
padding: 30px 20px;
}

Expand Down
13 changes: 8 additions & 5 deletions src/Pages/KKEMLearningFest/components/FAQs/FAQ.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
transition: all .3s ease-in-out;
}

.faqContainer .faqs .faq .questionContainer details[open] .arrow{
.faqContainer .faqs .faq .questionContainer details[open] .arrow {
rotate: 90deg;
}

Expand Down Expand Up @@ -104,12 +104,15 @@
}
}

@media(width<820px) {
.faqContainer .faqs {
padding: 10px;
}
@media(width<=1024px) {
.faqContainer {
width: 94%;
min-width: unset;
}
}

@media(width<820px) {
.faqContainer .faqs {
padding: 10px;
}
}

0 comments on commit a5302a5

Please sign in to comment.