diff --git a/src/blocks/Affiliation/Component.tsx b/src/blocks/Affiliation/Component.tsx index f18d3cc..403a177 100644 --- a/src/blocks/Affiliation/Component.tsx +++ b/src/blocks/Affiliation/Component.tsx @@ -13,7 +13,7 @@ const iconMap = { landmark: Landmark, } -export const AffiliationBlock: React.FC = ({ eyebrow, title, description, logo, linkText, trustPoints }) => { +export const AffiliationBlock: React.FC = ({ eyebrow, title, description, logo, linkText, linkUrl, trustPoints }) => { return (
@@ -32,10 +32,16 @@ export const AffiliationBlock: React.FC = ({ eyebrow, title, description, {logo.alt
)} - {linkText && ( - - {linkText} - + {linkText && linkUrl && ( + linkUrl.startsWith('#') ? ( + + {linkText} + + ) : ( + + {linkText} + + ) )} diff --git a/src/blocks/Affiliation/config.ts b/src/blocks/Affiliation/config.ts index 4325cf7..734bf83 100644 --- a/src/blocks/Affiliation/config.ts +++ b/src/blocks/Affiliation/config.ts @@ -26,5 +26,6 @@ export const Affiliation: Block = { ], }, { name: 'linkText', type: 'text', localized: true }, + { name: 'linkUrl', type: 'text', localized: true }, ], } diff --git a/src/blocks/RenderBlocks.tsx b/src/blocks/RenderBlocks.tsx index abd8c8e..aa8891c 100644 --- a/src/blocks/RenderBlocks.tsx +++ b/src/blocks/RenderBlocks.tsx @@ -15,6 +15,7 @@ import { FinalCTABlock } from './FinalCTA/Component' import { PageHeaderBlock } from './PageHeader/Component' import { ContactInfoBlock } from './ContactInfo/Component' import { BioBlock } from './Bio/Component' +import { TeamBlock } from './Team/Component' import { ServicesDetailedBlock } from './ServicesDetailed/Component' import { EligibilityBlock } from './Eligibility/Component' import { StatsBlock } from './Stats/Component' @@ -23,6 +24,7 @@ const blockComponents = { pageHeader: PageHeaderBlock, contactInfo: ContactInfoBlock, bio: BioBlock, + team: TeamBlock, servicesDetailed: ServicesDetailedBlock, eligibility: EligibilityBlock, hero: HeroBlock, diff --git a/src/blocks/Team/Component.tsx b/src/blocks/Team/Component.tsx new file mode 100644 index 0000000..1f5f99f --- /dev/null +++ b/src/blocks/Team/Component.tsx @@ -0,0 +1,77 @@ +'use client' +import React from 'react' +import type { Page, Media } from '../../payload-types' +import Image from 'next/image' +import Link from 'next/link' +import { motion } from 'framer-motion' + +type Props = Extract[0], { blockType: 'team' }> + +export const TeamBlock: React.FC = ({ members }) => { + if (!members || members.length === 0) return null + + return ( +
+
+ + {members.map((member: NonNullable[0], index: number) => { + const photo = typeof member.photo === 'object' && member.photo !== null ? (member.photo as Media) : null + const initial = member.name ? member.name.charAt(0).toUpperCase() : '' + + return ( +
+
+ {photo && photo.url ? ( + {photo.alt + ) : ( +
+ {initial} +
+ )} +
+ +
+

+ {member.name} +

+

+ {member.role} +

+ + {member.description && ( +

+ {member.description} +

+ )} + + {member.bookingUrl && ( +
+ + Umów się + +
+ )} +
+
+ ) + })} +
+
+
+ ) +} diff --git a/src/blocks/Team/config.ts b/src/blocks/Team/config.ts new file mode 100644 index 0000000..8814033 --- /dev/null +++ b/src/blocks/Team/config.ts @@ -0,0 +1,20 @@ +import type { Block } from 'payload' + +export const Team: Block = { + slug: 'team', + fields: [ + { + name: 'members', + type: 'array', + localized: true, + maxRows: 20, + fields: [ + { name: 'name', type: 'text', required: true }, + { name: 'role', type: 'text', required: true }, + { name: 'description', type: 'textarea' }, + { name: 'photo', type: 'upload', relationTo: 'media' }, + { name: 'bookingUrl', type: 'text' }, + ], + }, + ], +} diff --git a/src/collections/Pages.ts b/src/collections/Pages.ts index dcac124..ba7616f 100644 --- a/src/collections/Pages.ts +++ b/src/collections/Pages.ts @@ -17,6 +17,7 @@ import { Eligibility } from '../blocks/Eligibility/config' import { Stats } from '../blocks/Stats/config' import { TestimonialsGrid } from '../blocks/TestimonialsGrid/config' import { Bio } from '../blocks/Bio/config' +import { Team } from '../blocks/Team/config' export const Pages: CollectionConfig = { slug: 'pages', @@ -43,6 +44,7 @@ export const Pages: CollectionConfig = { PageHeader, ContactInfo, Bio, + Team, ServicesDetailed, Eligibility, Hero, diff --git a/src/payload-types.ts b/src/payload-types.ts index 1c53770..e4c8625 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -246,6 +246,21 @@ export interface Page { blockName?: string | null; blockType: 'bio'; } + | { + members?: + | { + name: string; + role: string; + description?: string | null; + photo?: (number | null) | Media; + bookingUrl?: string | null; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'team'; + } | { title: string; subtitle?: string | null; @@ -385,6 +400,7 @@ export interface Page { }[] | null; linkText?: string | null; + linkUrl?: string | null; id?: string | null; blockName?: string | null; blockType: 'affiliation'; @@ -653,6 +669,22 @@ export interface PagesSelect { id?: T; blockName?: T; }; + team?: + | T + | { + members?: + | T + | { + name?: T; + role?: T; + description?: T; + photo?: T; + bookingUrl?: T; + id?: T; + }; + id?: T; + blockName?: T; + }; servicesDetailed?: | T | { @@ -814,6 +846,7 @@ export interface PagesSelect { id?: T; }; linkText?: T; + linkUrl?: T; id?: T; blockName?: T; };