From da0e599b9a476f44f80489217a2524061dbd227c Mon Sep 17 00:00:00 2001 From: ArraysID Date: Sat, 10 May 2025 12:55:05 +0700 Subject: [PATCH] feat: enhance LearningResourcesSection with primary and secondary button links --- .../_components/learning-resources.tsx | 45 +++++++++---------- .../collections/LearningResourcesSection.ts | 43 ++++++++---------- apps/landing/src/payload-types.ts | 4 ++ 3 files changed, 43 insertions(+), 49 deletions(-) diff --git a/apps/landing/src/app/(frontend)/_components/learning-resources.tsx b/apps/landing/src/app/(frontend)/_components/learning-resources.tsx index 2af7ae8..b64e945 100644 --- a/apps/landing/src/app/(frontend)/_components/learning-resources.tsx +++ b/apps/landing/src/app/(frontend)/_components/learning-resources.tsx @@ -36,19 +36,16 @@ export function LearningResources(props: LearningResourcesSection) { id="sumber-belajar" className="w-full py-20 md:py-32 relative overflow-hidden" > - {/* Background Elements */}
-

@@ -59,52 +56,46 @@ export function LearningResources(props: LearningResourcesSection) {

- - {resources?.map((resource, index) => ( + {resources.map((r, i) => (
- -
))} - - {/* Featured Resource */}
@@ -119,10 +110,16 @@ export function LearningResources(props: LearningResourcesSection) { {featured.description}

diff --git a/apps/landing/src/collections/LearningResourcesSection.ts b/apps/landing/src/collections/LearningResourcesSection.ts index 2689245..ddc8505 100644 --- a/apps/landing/src/collections/LearningResourcesSection.ts +++ b/apps/landing/src/collections/LearningResourcesSection.ts @@ -1,3 +1,4 @@ +// payload config import { GlobalConfig } from 'payload'; export const LearningResourcesSection: GlobalConfig = { @@ -22,31 +23,11 @@ export const LearningResourcesSection: GlobalConfig = { type: 'array', required: true, fields: [ - { - name: 'icon', - type: 'text', - required: true, - }, - { - name: 'title', - type: 'text', - required: true, - }, - { - name: 'description', - type: 'textarea', - required: true, - }, - { - name: 'buttonText', - type: 'text', - required: true, - }, - { - name: 'buttonLink', - type: 'text', - required: true, - }, + { name: 'icon', type: 'text', required: true }, + { name: 'title', type: 'text', required: true }, + { name: 'description', type: 'textarea', required: true }, + { name: 'buttonText', type: 'text', required: true }, + { name: 'buttonLink', type: 'text', required: true }, ], defaultValue: [ { @@ -112,12 +93,24 @@ export const LearningResourcesSection: GlobalConfig = { required: true, defaultValue: 'Mulai Kursus', }, + { + name: 'primaryButtonLink', + type: 'text', + required: true, + defaultValue: '#', + }, { name: 'secondaryButtonText', type: 'text', required: true, defaultValue: 'Lihat Silabus', }, + { + name: 'secondaryButtonLink', + type: 'text', + required: true, + defaultValue: '#', + }, ], }, ], diff --git a/apps/landing/src/payload-types.ts b/apps/landing/src/payload-types.ts index e172913..c96a803 100644 --- a/apps/landing/src/payload-types.ts +++ b/apps/landing/src/payload-types.ts @@ -370,7 +370,9 @@ export interface LearningResourcesSection { title: string; description: string; primaryButtonText: string; + primaryButtonLink: string; secondaryButtonText: string; + secondaryButtonLink: string; }; updatedAt?: string | null; createdAt?: string | null; @@ -473,7 +475,9 @@ export interface LearningResourcesSectionSelect { title?: T; description?: T; primaryButtonText?: T; + primaryButtonLink?: T; secondaryButtonText?: T; + secondaryButtonLink?: T; }; updatedAt?: T; createdAt?: T;