|
1 | 1 | --- |
2 | 2 | // @ts-ignore |
3 | | -import { getCollection } from 'astro:content'; |
4 | | -import { meta } from '../../utils/const'; |
5 | | -import { df, compareByDate } from '../../utils/index.ts'; |
| 3 | +import { getCollection } from "astro:content"; |
| 4 | +import { meta } from "../../utils/const"; |
| 5 | +import { df, compareByDate } from "../../utils/index.ts"; |
6 | 6 |
|
7 | | -const certificates = await getCollection('certificates'); |
| 7 | +const certificates = await getCollection("certificates"); |
8 | 8 | certificates.sort(compareByDate); |
9 | 9 | --- |
10 | 10 |
|
11 | 11 | <main> |
12 | | - <section class="py-2" id="certificates"> |
13 | | - <div class="mb-8"> |
14 | | - <h3 class="text-3xl font-bold mb-4 bg-gradient-to-r from-muf-500 via-muf-blue-500 to-muf-blue-600 bg-clip-text text-transparent flex items-center"> |
15 | | - <i class="fa-solid fa-certificate bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent mr-3"></i> |
16 | | - { meta.certificate.title } |
17 | | - </h3> |
18 | | - <p class="text-gray-700 dark:text-gray-300 text-lg leading-relaxed"> |
19 | | - { meta.certificate.description } |
20 | | - </p> |
21 | | - </div> |
22 | | - |
| 12 | + <section class="py-2" id="certificates"> |
| 13 | + <div class="mb-8"> |
| 14 | + <h3 |
| 15 | + class="text-3xl font-bold mb-4 bg-gradient-to-r from-muf-500 via-muf-blue-500 to-muf-blue-600 bg-clip-text text-transparent flex items-center" |
| 16 | + > |
| 17 | + <i |
| 18 | + class="fa-solid fa-certificate bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent mr-3" |
| 19 | + ></i> |
| 20 | + {meta.certificate.title} |
| 21 | + </h3> |
| 22 | + <p class="text-gray-700 dark:text-gray-300 text-lg leading-relaxed"> |
| 23 | + {meta.certificate.description} |
| 24 | + </p> |
| 25 | + </div> |
| 26 | + |
23 | 27 | <div class="space-y-4"> |
24 | | - {certificates.map((certificate:any, index: number) => ( |
25 | | - <div class="glass-card overflow-hidden animate-slide-up" style={`animation-delay: ${index * 0.1}s;`}> |
26 | | - <button |
27 | | - data-id={index} |
28 | | - class="accordion-button flex justify-between items-center w-full p-6 text-left hover:bg-white/10 dark:hover:bg-white/5 transition-all duration-300 group" |
29 | | - > |
30 | | - <div class="flex items-center gap-4"> |
31 | | - <div class="w-3 h-3 rounded-full bg-gradient-to-r from-muf-500 to-muf-blue-500"></div> |
32 | | - <div> |
33 | | - <h4 class="font-bold text-gray-800 dark:text-gray-200 text-lg group-hover:text-gray-900 dark:group-hover:text-gray-100 transition-all duration-300"> |
34 | | - {certificate.data.title} |
35 | | - </h4> |
36 | | - <p class="text-gray-600 dark:text-gray-400 text-sm"> |
37 | | - <i class="fa-solid fa-building mr-2 bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent"></i> |
38 | | - {certificate.data.institute} • {df.format(certificate.data.completed)} |
39 | | - </p> |
40 | | - </div> |
41 | | - </div> |
42 | | - <div class="flex items-center gap-2"> |
43 | | - <i class="fa-solid fa-trophy bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent text-xl"></i> |
44 | | - <i class="fa-solid fa-chevron-down text-gray-400 group-hover:text-gray-600 dark:group-hover:text-gray-300 transition-all duration-300 transform group-data-[expanded]:rotate-180"></i> |
45 | | - </div> |
46 | | - </button> |
47 | | - |
48 | | - <div data-id={index} class="accordion-content overflow-hidden transition-all duration-500 max-h-0"> |
49 | | - <div class="p-6 pt-0 border-t border-white/10"> |
50 | | - <div class="grid grid-cols-1 lg:grid-cols-2 gap-6"> |
51 | | - <div class="space-y-4"> |
52 | | - <div class="flex items-center gap-3"> |
53 | | - <i class="fa-solid fa-calendar bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent"></i> |
54 | | - <span class="text-gray-700 dark:text-gray-300"> |
55 | | - Completed: {df.format(certificate.data.completed)} |
56 | | - </span> |
| 28 | + { |
| 29 | + certificates.map((certificate: any, index: number) => ( |
| 30 | + <div class="glass-panel"> |
| 31 | + <div |
| 32 | + class="glass-card overflow-hidden animate-slide-up" |
| 33 | + style={`animation-delay: ${index * 0.1}s;`} |
| 34 | + > |
| 35 | + <button |
| 36 | + data-id={index} |
| 37 | + class="accordion-button flex justify-between items-center w-full p-6 text-left hover:bg-white/10 dark:hover:bg-white/5 transition-all duration-300 group" |
| 38 | + > |
| 39 | + <div class="flex items-center gap-4"> |
| 40 | + <div class="w-3 h-3 rounded-full bg-gradient-to-r from-muf-500 to-muf-blue-500" /> |
| 41 | + <div> |
| 42 | + <h4 class="font-bold text-gray-800 dark:text-gray-200 text-lg group-hover:text-gray-900 dark:group-hover:text-gray-100 transition-all duration-300"> |
| 43 | + {certificate.data.title} |
| 44 | + </h4> |
| 45 | + <p class="text-gray-600 dark:text-gray-400 text-sm"> |
| 46 | + <i class="fa-solid fa-building mr-2 bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent" /> |
| 47 | + {certificate.data.institute} •{" "} |
| 48 | + {df.format( |
| 49 | + certificate.data.completed, |
| 50 | + )} |
| 51 | + </p> |
57 | 52 | </div> |
58 | | - <a |
59 | | - href={certificate.data.link} |
60 | | - target="_blank" |
61 | | - class="glass-button inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent hover:text-gray-800 dark:hover:text-gray-200 hover:bg-none font-semibold transition-all duration-300 hover:scale-105" |
62 | | - > |
63 | | - <i class="fa-solid fa-external-link"></i> |
64 | | - View Certificate |
65 | | - </a> |
66 | 53 | </div> |
67 | | - <div class="glass-card p-4"> |
68 | | - <img |
69 | | - src={certificate.data.picture} |
70 | | - alt={certificate.data.title} |
71 | | - class="w-full h-auto rounded-lg shadow-lg hover:scale-105 transition-transform duration-300" |
72 | | - /> |
| 54 | + <div class="flex items-center gap-2"> |
| 55 | + <i class="fa-solid fa-trophy bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent text-xl" /> |
| 56 | + <i class="fa-solid fa-chevron-down text-gray-400 group-hover:text-gray-600 dark:group-hover:text-gray-300 transition-all duration-300 transform group-data-[expanded]:rotate-180" /> |
| 57 | + </div> |
| 58 | + </button> |
| 59 | + |
| 60 | + <div |
| 61 | + data-id={index} |
| 62 | + class="accordion-content overflow-hidden transition-all duration-500 max-h-0" |
| 63 | + > |
| 64 | + <div class="p-6 pt-0 border-t border-white/10"> |
| 65 | + <div class="grid grid-cols-1 lg:grid-cols-2 gap-6"> |
| 66 | + <div class="space-y-4"> |
| 67 | + <div class="flex items-center gap-3"> |
| 68 | + <i class="fa-solid fa-calendar bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent" /> |
| 69 | + <span class="text-gray-700 dark:text-gray-300"> |
| 70 | + Completed:{" "} |
| 71 | + {df.format( |
| 72 | + certificate.data |
| 73 | + .completed, |
| 74 | + )} |
| 75 | + </span> |
| 76 | + </div> |
| 77 | + <a |
| 78 | + href={certificate.data.link} |
| 79 | + target="_blank" |
| 80 | + class="glass-button inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-muf-500 to-muf-blue-500 bg-clip-text text-transparent hover:text-gray-800 dark:hover:text-gray-200 hover:bg-none font-semibold transition-all duration-300 hover:scale-105" |
| 81 | + > |
| 82 | + <i class="fa-solid fa-external-link" /> |
| 83 | + View Certificate |
| 84 | + </a> |
| 85 | + </div> |
| 86 | + <div class="glass-card p-4"> |
| 87 | + <img |
| 88 | + src={certificate.data.picture} |
| 89 | + alt={certificate.data.title} |
| 90 | + class="w-full h-auto rounded-lg shadow-lg hover:scale-105 transition-transform duration-300" |
| 91 | + /> |
| 92 | + </div> |
| 93 | + </div> |
73 | 94 | </div> |
74 | 95 | </div> |
75 | 96 | </div> |
76 | 97 | </div> |
77 | | - </div> |
78 | | - ))} |
| 98 | + )) |
| 99 | + } |
79 | 100 | </div> |
80 | 101 | </section> |
81 | 102 | </main> |
82 | 103 |
|
83 | 104 | <script lang="js"> |
84 | | -document.addEventListener('DOMContentLoaded', function() { |
85 | | - let buttons = document.querySelectorAll('.accordion-button'); |
86 | | - for (let i = 0; i < buttons.length; i++) { |
87 | | - buttons[i].addEventListener('click', function () { |
88 | | - let content = document.querySelectorAll('.accordion-content'); |
89 | | - let id = this.getAttribute('data-id'); |
90 | | - let targetContent = content[id]; |
91 | | - let chevron = this.querySelector('.fa-chevron-down'); |
92 | | - |
93 | | - if (targetContent.style.maxHeight && targetContent.style.maxHeight !== '0px') { |
94 | | - targetContent.style.maxHeight = '0px'; |
95 | | - chevron.style.transform = 'rotate(0deg)'; |
96 | | - } else { |
97 | | - targetContent.style.maxHeight = targetContent.scrollHeight + 'px'; |
98 | | - chevron.style.transform = 'rotate(180deg)'; |
99 | | - } |
100 | | - }); |
101 | | - } |
102 | | -}); |
103 | | -</script> |
| 105 | + document.addEventListener("DOMContentLoaded", function () { |
| 106 | + let buttons = document.querySelectorAll(".accordion-button"); |
| 107 | + for (let i = 0; i < buttons.length; i++) { |
| 108 | + buttons[i].addEventListener("click", function () { |
| 109 | + let content = document.querySelectorAll(".accordion-content"); |
| 110 | + let id = this.getAttribute("data-id"); |
| 111 | + let targetContent = content[id]; |
| 112 | + let chevron = this.querySelector(".fa-chevron-down"); |
104 | 113 |
|
| 114 | + if ( |
| 115 | + targetContent.style.maxHeight && |
| 116 | + targetContent.style.maxHeight !== "0px" |
| 117 | + ) { |
| 118 | + targetContent.style.maxHeight = "0px"; |
| 119 | + chevron.style.transform = "rotate(0deg)"; |
| 120 | + } else { |
| 121 | + targetContent.style.maxHeight = |
| 122 | + targetContent.scrollHeight + "px"; |
| 123 | + chevron.style.transform = "rotate(180deg)"; |
| 124 | + } |
| 125 | + }); |
| 126 | + } |
| 127 | + }); |
| 128 | +</script> |
0 commit comments