Files
supabase/apps/www/components/Solutions/PostGrid.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

74 lines
2.3 KiB
TypeScript

import Image from 'next/image'
import Link from 'next/link'
import { cn } from 'ui'
import { getSortedPosts } from '~/lib/posts'
import SectionContainer from '../Layouts/SectionContainer'
interface PostGridProps {
id?: string
className?: string
header: React.ReactNode
subheader: React.ReactNode
posts: ReturnType<typeof getSortedPosts>
}
function PostGrid({ id, className, header, subheader, posts }: PostGridProps) {
const hasPosts = posts.length > 0
return (
<SectionContainer id={id} className={cn('flex flex-col gap-12 py-16 md:py-24', className)}>
<div className="flex flex-col lg:max-w-[50%]">
<h2 className="h2">{header}</h2>
<p className="p">{subheader}</p>
</div>
{hasPosts ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{posts.map((post) => (
<Link
href={post.path}
className="border rounded-md flex flex-col relative overflow-hidden"
key={post.slug}
>
{post.imgThumb && (
<div className="w-full aspect-video relative rounded-t-md dark:mask-[linear-gradient(to_bottom,#000_0%,#000_60%,transparent_100%)]">
<Image
src={
post.imgThumb.startsWith('/') || post.imgThumb.startsWith('http')
? post.imgThumb
: `/images/blog/${post.imgThumb}`
}
alt={post.title || ''}
className="object-cover"
fill
/>
</div>
)}
<div className="p-3 mt-auto flex flex-col gap-1">
<h3 className="p mb-0! text-foreground! line-clamp-1">{post.title}</h3>
<p className="text-sm mb-0! text-foreground-light! inline-flex items-center gap-2">
<span>{post.readingTime}</span>
</p>
</div>
</Link>
))}
</div>
) : (
<p className="p">No posts found</p>
)}
</SectionContainer>
)
}
export default PostGrid
function formatDate(date: string) {
return new Date(date).toLocaleDateString('en-US', {
month: 'long',
day: 'numeric',
year: 'numeric',
})
}