From 13ab089afc0a844ef7869b87c3adaa9eee8a8b7e Mon Sep 17 00:00:00 2001 From: ArraysID Date: Sat, 10 May 2025 07:45:29 +0700 Subject: [PATCH] feat: update FeaturesSection to use Iconify icons and adjust icon properties --- .../app/(frontend)/_components/features.tsx | 35 ++++--------------- .../src/collections/FeaturesSection.ts | 20 +++++------ apps/landing/src/payload-types.ts | 8 ++--- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/apps/landing/src/app/(frontend)/_components/features.tsx b/apps/landing/src/app/(frontend)/_components/features.tsx index 20c82e8..35a970a 100644 --- a/apps/landing/src/app/(frontend)/_components/features.tsx +++ b/apps/landing/src/app/(frontend)/_components/features.tsx @@ -1,11 +1,6 @@ 'use client'; -import { - BookOpenIcon, - CodeIcon, - LaptopIcon, - UsersIcon, -} from '@imphnen-frontend-service/shadcn-ui/atoms'; +import { Icon } from '@iconify/react'; import { FeaturesSection } from 'apps/landing/src/payload-types'; import { motion, useInView } from 'framer-motion'; import { useRef } from 'react'; @@ -13,12 +8,6 @@ import { useRef } from 'react'; export function Features(props: FeaturesSection) { const { heading, subheading, features } = props; - const featuresFormatted = features?.map((f) => ({ - icon: IconMapper(String(f.icon)), - title: f.title, - description: f.description, - })); - const ref = useRef(null); const isInView = useInView(ref, { once: true, amount: 0.2 }); @@ -77,7 +66,7 @@ export function Features(props: FeaturesSection) { initial="hidden" animate={isInView ? 'visible' : 'hidden'} > - {featuresFormatted?.map((feature, index) => ( + {features?.map((feature, index) => (
- {feature.icon} +

{feature.title}

{feature.description}

@@ -101,18 +93,3 @@ export function Features(props: FeaturesSection) { ); } - -function IconMapper(name: string) { - switch (name) { - case 'LaptopIcon': - return ; - case 'UsersIcon': - return ; - case 'BookOpenIcon': - return ; - case 'CodeIcon': - return ; - default: - return null; - } -} diff --git a/apps/landing/src/collections/FeaturesSection.ts b/apps/landing/src/collections/FeaturesSection.ts index 37a058a..4ae5dc2 100644 --- a/apps/landing/src/collections/FeaturesSection.ts +++ b/apps/landing/src/collections/FeaturesSection.ts @@ -20,25 +20,25 @@ export const FeaturesSection: GlobalConfig = { type: 'array', defaultValue: [ { - icon: 'LaptopIcon', + iconName: 'tabler:device-laptop', title: 'Belajar Tanpa Koding', description: 'Pelajari konsep programming dengan cara yang mudah dipahami tanpa harus menulis kode yang rumit.', }, { - icon: 'UsersIcon', + iconName: 'tabler:users', title: 'Komunitas Supportif', description: 'Bergabunglah dengan komunitas programmer Indonesia yang siap membantu dan berbagi pengalaman.', }, { - icon: 'BookOpenIcon', + iconName: 'tabler:book', title: 'Tutorial Interaktif', description: 'Akses tutorial interaktif yang membuat konsep programming lebih mudah untuk dipahami.', }, { - icon: 'CodeIcon', + iconName: 'tabler:code', title: 'Proyek Praktis', description: 'Terapkan pengetahuan Anda dalam proyek nyata dengan panduan langkah demi langkah.', @@ -46,18 +46,14 @@ export const FeaturesSection: GlobalConfig = { ], fields: [ { - name: 'icon', - type: 'select', - options: [ - { label: 'LaptopIcon', value: 'LaptopIcon' }, - { label: 'UsersIcon', value: 'UsersIcon' }, - { label: 'BookOpenIcon', value: 'BookOpenIcon' }, - { label: 'CodeIcon', value: 'CodeIcon' }, - ], + name: 'iconName', + type: 'text', + required: true, }, { name: 'title', type: 'text', + required: true, }, { name: 'description', diff --git a/apps/landing/src/payload-types.ts b/apps/landing/src/payload-types.ts index 4ef1e98..f9d36fa 100644 --- a/apps/landing/src/payload-types.ts +++ b/apps/landing/src/payload-types.ts @@ -315,8 +315,8 @@ export interface FeaturesSection { subheading?: string | null; features?: | { - icon?: ('LaptopIcon' | 'UsersIcon' | 'BookOpenIcon' | 'CodeIcon') | null; - title?: string | null; + iconName: string; + title: string; description?: string | null; id?: string | null; }[] @@ -331,7 +331,7 @@ export interface FeaturesSection { export interface CommunitiesSection { id: number; items: { - iconName: 'FacebookIcon' | 'InstagramIcon' | 'MessageCircleIcon'; + iconName: string; title: string; description: string; buttonText: string; @@ -384,7 +384,7 @@ export interface FeaturesSectionSelect { features?: | T | { - icon?: T; + iconName?: T; title?: T; description?: T; id?: T;