File tree Expand file tree Collapse file tree 2 files changed +66
-1
lines changed
assets/styles/alphabets/[alphabet]
pages/alphabets/[alphabet] Expand file tree Collapse file tree 2 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 99 justify-content : flex-start;
1010 padding : 1rem ;
1111
12+ & .head {
13+ display : flex;
14+ gap : 1rem ;
15+ align-items : center;
16+ width : 100% ;
17+ justify-content : space-between;
18+ padding : 1rem ;
19+ border-radius : 0.5rem ;
20+ font-weight : 600 ;
21+ box-shadow : 0 0 10px rgba (0 , 0 , 0 , 0.1 );
22+
23+ & .back {
24+ margin-bottom : 0 !important ;
25+ }
26+ }
27+
28+ & .flip__all__button {
29+ background-color : var (--background );
30+ border : none;
31+ padding : 0.5rem 1rem ;
32+ border-radius : 0.5rem ;
33+ font-weight : 200 ;
34+ margin : 1rem 0 ;
35+ cursor : pointer;
36+ transition : all 0.3s ease;
37+ align-self : flex-end;
38+ }
39+
40+ & .flip__all__button : hover {
41+ transform : translateY (-2px );
42+ }
43+
44+ & .flip__all__button .active {
45+ transform : scale (0.95 );
46+ background-color : color-mix (in srgb, var (--primary ) 70% , black 30% );
47+ }
48+
1249 & .container__alphabet {
1350 display : grid;
1451 gap : 2rem ;
Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ const data = alphabetData[alphabet as keyof AlphabetsData].data;
2727
2828<BaseLayout meta ={ { title: ` Alphabets - ${alphabet .charAt (0 ).toUpperCase () + alphabet .slice (1 )} ` }} >
2929 <article class =" container__alphabets" >
30- <BackButton />
30+ <div class =" head" >
31+ <BackButton />
32+ <button id =" flip-all-button" class =" flip__all__button" >Flip All Cards</button >
33+ </div >
3134 <div class =" container__alphabet" >
3235 <div class =" list" >
3336 {
@@ -39,4 +42,29 @@ const data = alphabetData[alphabet as keyof AlphabetsData].data;
3942 </div >
4043 </div >
4144 </article >
45+
46+ <script >
47+ const flipAllButton = document.getElementById("flip-all-button") as HTMLButtonElement;
48+ const flipCards = document.querySelectorAll(".flip__card");
49+ let allFlipped = false;
50+
51+ flipAllButton.addEventListener("click", () => {
52+ allFlipped = !allFlipped;
53+
54+ flipCards.forEach((card) => {
55+ if (allFlipped) {
56+ card.classList.add("flipped");
57+ } else {
58+ card.classList.remove("flipped");
59+ }
60+ });
61+
62+ flipAllButton.textContent = allFlipped ? "Reset All Cards" : "Flip All Cards";
63+
64+ flipAllButton.classList.add("active");
65+ setTimeout(() => {
66+ flipAllButton.classList.remove("active");
67+ }, 300);
68+ });
69+ </script >
4270</BaseLayout >
You can’t perform that action at this time.
0 commit comments