From 4adf5472655cfe84da874ada5809728c5b0ae970 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sun, 1 Mar 2026 11:17:30 +0100 Subject: [PATCH] chore(blog): improve image quality and fix list item alignment; fix(hero): refactor title rendering to resolve console error; bump version to 2.0.3 --- app/[locale]/blog/[slug]/page.tsx | 1 + components/PayloadRichText.tsx | 6 +++--- components/home/Hero.tsx | 34 +++++++++++++++++++------------ lib/blog.ts | 4 ++-- package.json | 2 +- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/app/[locale]/blog/[slug]/page.tsx b/app/[locale]/blog/[slug]/page.tsx index c58938c8..a5aed315 100644 --- a/app/[locale]/blog/[slug]/page.tsx +++ b/app/[locale]/blog/[slug]/page.tsx @@ -88,6 +88,7 @@ export default async function BlogPost({ params }: BlogPostProps) { alt={post.frontmatter.title} fill priority + quality={90} className="object-cover" sizes="100vw" style={{ diff --git a/components/PayloadRichText.tsx b/components/PayloadRichText.tsx index 598441f8..c3de9da9 100644 --- a/components/PayloadRichText.tsx +++ b/components/PayloadRichText.tsx @@ -42,7 +42,7 @@ const jsxConverters: JSXConverters = { // Use div instead of p for paragraphs to allow nested block elements (like the lists above) paragraph: ({ node, nodesToJSX }: any) => { return ( -
+
{nodesToJSX({ nodes: node.children })}
); @@ -77,7 +77,7 @@ const jsxConverters: JSXConverters = { const children = nodesToJSX({ nodes: node.children }); if (node?.listType === 'number') { return ( -
    +
      {children}
    ); @@ -86,7 +86,7 @@ const jsxConverters: JSXConverters = { return
      {children}
    ; } return ( -
      +
        {children}
      ); diff --git a/components/home/Hero.tsx b/components/home/Hero.tsx index a3408da5..20284d68 100644 --- a/components/home/Hero.tsx +++ b/components/home/Hero.tsx @@ -23,19 +23,27 @@ export default function Hero({ data }: { data?: any }) { className="text-center md:text-left mb-6 md:mb-8 md:max-w-none text-white text-4xl sm:text-5xl md:text-7xl font-extrabold [text-shadow:_-2px_-2px_0_#002b49,_2px_-2px_0_#002b49,_-2px_2px_0_#002b49,_2px_2px_0_#002b49,_-2px_0_0_#002b49,_2px_0_0_#002b49,_0_-2px_0_#002b49,_0_2px_0_#002b49]" > {data?.title ? ( - /g, - '', - ) - .replace( - /<\/green>/g, - '', - ), - }} - /> + <> + {data.title.split(/(.*?<\/green>)/g).map((part: string, i: number) => { + if (part.startsWith('') && part.endsWith('')) { + const content = part.replace(/<\/?green>/g, ''); + return ( + + + {content} + +
      + +
      +
      + ); + } + return {part}; + })} + ) : ( t.rich('title', { green: (chunks) => ( diff --git a/lib/blog.ts b/lib/blog.ts index 196efea3..db765d6f 100644 --- a/lib/blog.ts +++ b/lib/blog.ts @@ -116,7 +116,7 @@ export async function getPostBySlug(slug: string, locale: string): Promise { category: doc.category || '', featuredImage: typeof doc.featuredImage === 'object' && doc.featuredImage !== null - ? doc.featuredImage.sizes?.card?.url || doc.featuredImage.url + ? doc.featuredImage.url || doc.featuredImage.sizes?.card?.url : null, focalX: typeof doc.featuredImage === 'object' && doc.featuredImage !== null diff --git a/package.json b/package.json index cacbf3a5..973753cd 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "prepare": "husky", "preinstall": "npx only-allow pnpm" }, - "version": "2.0.2", + "version": "2.2.5", "pnpm": { "onlyBuiltDependencies": [ "@parcel/watcher",