The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix featured blog post layout breaking on mobile with many authors (#48114)
Francesco Sansalvadore1952abb6d1f5
diff --git a/apps/www/components/Blog/AuthorAvatars.tsx b/apps/www/components/Blog/AuthorAvatars.tsxindex a0da27b8002..fc3fbf3a732 100644--- a/apps/www/components/Blog/AuthorAvatars.tsx+++ b/apps/www/components/Blog/AuthorAvatars.tsx@@ -1,4 +1,5 @@import Image from 'next/image'+import { Tooltip, TooltipContent, TooltipTrigger } from 'ui'import type Author from '@/types/author'@@ -8,40 +9,53 @@ interface Props {size?: 'sm' | 'md'}+const MAX_VISIBLE_AVATARS = 4+export default function AuthorAvatars({ authors, showName = true, size = 'sm' }: Props) {const valid = authors.filter(Boolean) as Author[]if (!valid.length) return nullconst px = size === 'md' ? 'w-6 h-6' : 'w-5 h-5'+ const visibleAvatars = valid.slice(0, MAX_VISIBLE_AVATARS)+ const allNames = valid.map((a) => a.author).join(', ')- return (- <div className="flex items-center gap-2">- <div className="flex items-center -space-x-1.5">- {valid.map((author, i) => (- <div- key={i}- className={`relative ${px} rounded-full ring-2 ring-background border border-foreground/20 overflow-hidden shrink-0`}- >- {author.author_image_url && (- <Image- src={- typeof author.author_image_url === 'string'- ? author.author_image_url- : (author.author_image_url as { url: string }).url- }- fill- className="object-cover"- alt={showName ? '' : author.author}- />- )}+ const nameLabel =+ valid.length > 2+ ? `${valid[0].author}, +${valid.length - 1} other${valid.length - 1 > 1 ? 's' : ''}`+ : allNames++ const content = (+ <div className="flex items-center gap-2 min-w-0" tabIndex={0}>+ <div className="flex items-center -space-x-1.5 shrink-0">+ {visibleAvatars.map((author, i) => (+ <div key={i} className={`relative ${px} rounded-full bg-background shrink-0 p-px`}>+ <div className="relative w-full h-full rounded-full border border-foreground/20 overflow-hidden">+ {author.author_image_url && (+ <Image+ src={+ typeof author.author_image_url === 'string'+ ? author.author_image_url+ : (author.author_image_url as { url: string }).url+ }+ fill+ className="object-cover"+ alt={showName ? '' : author.author}+ />+ )}+ </div></div>))}</div>- {showName && (- <p className="text-foreground-lighter text-xs truncate">- {valid.map((a) => a.author).join(', ')}- </p>- )}+ {showName && <p className="text-foreground-lighter text-xs truncate min-w-0">{nameLabel}</p>}</div>)++ return (+ <Tooltip>+ <TooltipTrigger asChild>{content}</TooltipTrigger>+ <TooltipContent side="bottom" className="max-w-[260px]">+ {allNames}+ </TooltipContent>+ </Tooltip>+ )}diff --git a/apps/www/components/Blog/FeaturedThumb.tsx b/apps/www/components/Blog/FeaturedThumb.tsxindex fdf89004cc0..8692e69c901 100644--- a/apps/www/components/Blog/FeaturedThumb.tsx+++ b/apps/www/components/Blog/FeaturedThumb.tsx@@ -51,7 +51,7 @@ function renderFeaturedThumb(blog: PostTypes, author: any[]) {</div>{/* Text */}- <div className="flex flex-col lg:col-span-6 md:justify-center">+ <div className="flex flex-col lg:col-span-6 md:justify-center lg:pr-8"><div><h2 className="h2 lg:text-2xl! xl:text-3xl! mb-2! group-hover:underline">{blog.title}@@ -59,18 +59,20 @@ function renderFeaturedThumb(blog: PostTypes, author: any[]) {<p className="p">{blog.description}</p></div>- <div className="flex items-center justify-between mt-4">- <div>+ <div className="flex items-center justify-between gap-4 mt-4">+ <div className="min-w-0 flex-1"><span className="sr-only">Author: </span><AuthorAvatars authors={author} size="md" /></div>- <div className="text-foreground-lighter flex space-x-2 text-sm">+ <div className="text-foreground-lighter flex shrink-0 space-x-2 text-xs"><span><span className="sr-only">Published </span>{blog.formattedDate}</span>- <span aria-hidden="true">·</span>- <span>{blog.readingTime}</span>+ <span aria-hidden="true" className="hidden sm:inline">+ ·+ </span>+ <span className="hidden sm:inline">{blog.readingTime}</span></div></div></div>