diff --git a/src/blocks/Showcase/Component.tsx b/src/blocks/Showcase/Component.tsx index 8e7fc71..4ce1076 100644 --- a/src/blocks/Showcase/Component.tsx +++ b/src/blocks/Showcase/Component.tsx @@ -1,15 +1,17 @@ 'use client' -import React from 'react' +import React, { useState } from 'react' import Image from 'next/image' import { Container } from '@/components/ui/Container' import type { Media as MediaType } from '@/payload-types' +// Updated type to include category for the 15-project Lab structure type ShowcaseItem = { image?: MediaType | null imageUrl?: string title: string description?: string + category: 'engineering' | 'design' tags?: { tag: string }[] links?: { label: string; url: string; newTab?: boolean }[] } @@ -20,125 +22,119 @@ type ShowcaseBlockProps = { items?: ShowcaseItem[] } -function ShowcaseImage(props: { item: ShowcaseItem }): React.ReactElement { - const item = props.item +function ShowcaseImage({ item }: { item: ShowcaseItem }): React.ReactElement { const image = item.image const imageUrl = image != null && typeof image === 'object' && 'url' in image ? image.url : null const imageAlt = image != null && typeof image === 'object' && 'alt' in image ? image.alt : item.title - if (imageUrl != null) { - const imgEl = ( -
+ const imgContent = ( +
+ {imageUrl ? ( {imageAlt - {item.imageUrl && ( + ) : ( +
+