From a02a259f4e9c5b95143286af7f39ced15aef528d Mon Sep 17 00:00:00 2001 From: ArraysID Date: Sat, 10 May 2025 12:48:07 +0700 Subject: [PATCH] feat: add Learning Resources section with dynamic data fetching and UI integration --- .../_components/learning-resources.tsx | 103 ++++----------- apps/landing/src/app/(frontend)/page.tsx | 15 ++- .../collections/LearningResourcesSection.ts | 124 ++++++++++++++++++ apps/landing/src/payload-types.ts | 58 ++++++++ apps/landing/src/payload.config.ts | 8 +- .../get-globals-learning-resources-section.ts | 7 + 6 files changed, 231 insertions(+), 84 deletions(-) create mode 100644 apps/landing/src/collections/LearningResourcesSection.ts create mode 100644 apps/landing/src/services/get-globals-learning-resources-section.ts diff --git a/apps/landing/src/app/(frontend)/_components/learning-resources.tsx b/apps/landing/src/app/(frontend)/_components/learning-resources.tsx index cfddf3a..2af7ae8 100644 --- a/apps/landing/src/app/(frontend)/_components/learning-resources.tsx +++ b/apps/landing/src/app/(frontend)/_components/learning-resources.tsx @@ -1,65 +1,17 @@ 'use client'; -import { - BookOpenIcon, - Button, - CodeIcon, - Share2Icon, - VideoIcon, -} from '@imphnen-frontend-service/shadcn-ui/atoms'; +import { Icon } from '@iconify/react'; +import { Button } from '@imphnen-frontend-service/shadcn-ui/atoms'; +import { LearningResourcesSection } from 'apps/landing/src/payload-types'; import { motion, useInView } from 'framer-motion'; - import { useRef } from 'react'; -export function LearningResources() { +export function LearningResources(props: LearningResourcesSection) { + const { resources, featured, title, description } = props; + const ref = useRef(null); const isInView = useInView(ref, { once: true, amount: 0.2 }); - const resources = [ - { - icon: , - iconBg: 'bg-blue-100 dark:bg-blue-900', - title: 'Video Tutorial', - description: - 'Belajar melalui tutorial video dari langkah awal hingga mahir.', - buttonText: 'Lihat Semua Video', - buttonLink: '#', - color: 'from-blue-500 to-blue-700', - }, - { - icon: ( - - ), - iconBg: 'bg-blue-100 dark:bg-blue-900', - title: 'Artikel & Tutorial', - description: - 'Pelajari konsep programming melalui artikel yang disusun secara terstruktur.', - buttonText: 'Baca Artikel', - buttonLink: '#', - color: 'from-blue-500 to-blue-700', - }, - { - icon: , - iconBg: 'bg-blue-100 dark:bg-blue-900', - title: 'Tantangan Koding', - description: - 'Uji kemampuan koding kamu dengan tantangan yang menyenangkan dan menantang.', - buttonText: 'Mulai Tantangan', - buttonLink: '#', - color: 'from-blue-500 to-blue-700', - }, - { - icon: , - iconBg: 'bg-blue-100 dark:bg-blue-900', - title: 'Sharing Session', - description: - 'Ikuti sesi berbagi pengalaman dari programmer berpengalaman dan belajar dari pengalaman mereka.', - buttonText: 'Jadwal Session', - buttonLink: '#', - color: 'from-blue-500 to-blue-700', - }, - ]; - const containerVariants = { hidden: { opacity: 0 }, visible: { @@ -100,14 +52,10 @@ export function LearningResources() { transition={{ duration: 0.5 }} >

- Sumber{' '} - - Belajar - + {title}

- Akses berbagai materi belajar yang akan membantu kamu menguasai - konsep programming dengan cara yang menyenangkan. + {description}

@@ -118,7 +66,7 @@ export function LearningResources() { initial="hidden" animate={isInView ? 'visible' : 'hidden'} > - {resources.map((resource, index) => ( + {resources?.map((resource, index) => (
-
- {resource.icon} +
+

{resource.title}

{resource.description}

- + + +
@@ -158,16 +109,14 @@ export function LearningResources() { >
-
- Rekomendasi Terbaik +
+ {featured.label}

- Kursus Lengkap Web Development + {featured.title}

- Pelajari HTML, CSS, JavaScript, React, dan Node.js dalam satu - kursus komprehensif yang dirancang untuk pemula hingga tingkat - menengah. + {featured.description}