From dccd07ac53788c0eb7cb15bdc53a4c69c34185ad Mon Sep 17 00:00:00 2001 From: Mackie Date: Mon, 1 Jun 2026 18:09:01 +0800 Subject: [PATCH] bg --- src/heros/LowImpact/index.tsx | 21 +++++++-- src/heros/config.ts | 35 +++++++------- src/payload-types.ts | 89 ++++++++++++++++++++++++++++++++++- 3 files changed, 124 insertions(+), 21 deletions(-) diff --git a/src/heros/LowImpact/index.tsx b/src/heros/LowImpact/index.tsx index 563da63..965f4ab 100644 --- a/src/heros/LowImpact/index.tsx +++ b/src/heros/LowImpact/index.tsx @@ -8,17 +8,30 @@ type LowImpactHeroType = | { children?: React.ReactNode richText?: never + theme?: never } | (Omit & { children?: never richText?: Page['hero']['richText'] + theme?: string }) -export const LowImpactHero: React.FC = ({ children, richText }) => { +const bgMap: Record = { + default: 'bg-transparent', + muted: 'bg-muted', + card: 'bg-card', + secondary: 'bg-secondary', +} + +export const LowImpactHero: React.FC = ({ children, richText, theme }) => { + const bg = bgMap[theme ?? 'default'] ?? 'bg-transparent' + return ( -
-
- {children || (richText && )} +
+
+
+ {children || (richText && )} +
) diff --git a/src/heros/config.ts b/src/heros/config.ts index 7bc2f24..27571b7 100644 --- a/src/heros/config.ts +++ b/src/heros/config.ts @@ -19,25 +19,28 @@ export const hero: Field = { defaultValue: 'lowImpact', label: 'Type', options: [ - { - label: 'None', - value: 'none', - }, - { - label: 'High Impact', - value: 'highImpact', - }, - { - label: 'Medium Impact', - value: 'mediumImpact', - }, - { - label: 'Low Impact', - value: 'lowImpact', - }, + { label: 'None', value: 'none' }, + { label: 'High Impact', value: 'highImpact' }, + { label: 'Medium Impact', value: 'mediumImpact' }, + { label: 'Low Impact', value: 'lowImpact' }, ], required: true, }, + { + name: 'theme', + type: 'select', + defaultValue: 'default', + label: 'Background', + admin: { + condition: (_, { type } = {}) => type === 'lowImpact', + }, + options: [ + { label: 'Default (Transparent)', value: 'default' }, + { label: 'Muted', value: 'muted' }, + { label: 'Card', value: 'card' }, + { label: 'Secondary', value: 'secondary' }, + ], + }, { name: 'richText', type: 'richText', diff --git a/src/payload-types.ts b/src/payload-types.ts index 8cad02f..4310331 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -160,6 +160,7 @@ export interface Page { title: string; hero: { type: 'none' | 'highImpact' | 'mediumImpact' | 'lowImpact'; + theme?: ('default' | 'muted' | 'card' | 'secondary') | null; richText?: { root: { type: string; @@ -201,7 +202,59 @@ export interface Page { | null; media?: (string | null) | Media; }; - layout: (CallToActionBlock | ContentBlock | MediaBlock | ArchiveBlock | FormBlock)[]; + layout: ( + | CallToActionBlock + | ContentBlock + | MediaBlock + | ArchiveBlock + | FormBlock + | { + heading?: string | null; + keySkills?: + | { + skill: string; + id?: string | null; + }[] + | null; + categories?: + | { + title: string; + icon?: + | ( + | 'ti-layout' + | 'ti-server' + | 'ti-vector-pen' + | 'ti-briefcase' + | 'ti-world' + | 'ti-camera' + | 'ti-tools' + | 'ti-sparkles' + | 'ti-device-mobile' + | 'ti-code' + | 'ti-chart-bar' + | 'ti-star' + ) + | null; + tags?: + | { + tag: string; + id?: string | null; + }[] + | null; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'skills'; + } + | { + heading?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'skillsMarquee'; + } + )[]; meta?: { title?: string | null; /** @@ -1063,6 +1116,7 @@ export interface PagesSelect { | T | { type?: T; + theme?: T; richText?: T; links?: | T @@ -1089,6 +1143,39 @@ export interface PagesSelect { mediaBlock?: T | MediaBlockSelect; archive?: T | ArchiveBlockSelect; formBlock?: T | FormBlockSelect; + skills?: + | T + | { + heading?: T; + keySkills?: + | T + | { + skill?: T; + id?: T; + }; + categories?: + | T + | { + title?: T; + icon?: T; + tags?: + | T + | { + tag?: T; + id?: T; + }; + id?: T; + }; + id?: T; + blockName?: T; + }; + skillsMarquee?: + | T + | { + heading?: T; + id?: T; + blockName?: T; + }; }; meta?: | T