1- import Image from 'next/image'
21import Link from 'next/link'
3- import { Avatar , AvatarFallback , AvatarImage } from '@/components/ui/avatar'
42import { getAllPostMeta } from '@/lib/blog/registry'
53import { soehne } from '@/app/_styles/fonts/soehne/soehne'
4+ import { PostGrid } from '@/app/(landing)/studio/post-grid'
65
76export const revalidate = 3600
87
@@ -18,7 +17,6 @@ export default async function StudioIndex({
1817 const all = await getAllPostMeta ( )
1918 const filtered = tag ? all . filter ( ( p ) => p . tags . includes ( tag ) ) : all
2019
21- // Sort to ensure featured post is first on page 1
2220 const sorted =
2321 pageNum === 1
2422 ? filtered . sort ( ( a , b ) => {
@@ -63,68 +61,7 @@ export default async function StudioIndex({
6361 </div> */ }
6462
6563 { /* Grid layout for consistent rows */ }
66- < div className = 'grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6 lg:grid-cols-3' >
67- { posts . map ( ( p , i ) => {
68- return (
69- < Link key = { p . slug } href = { `/studio/${ p . slug } ` } className = 'group flex flex-col' >
70- < div className = 'flex h-full flex-col overflow-hidden rounded-xl border border-gray-200 transition-colors duration-300 hover:border-gray-300' >
71- < Image
72- src = { p . ogImage }
73- alt = { p . title }
74- width = { 800 }
75- height = { 450 }
76- className = 'h-48 w-full object-cover'
77- sizes = '(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw'
78- loading = 'lazy'
79- />
80- < div className = 'flex flex-1 flex-col p-4' >
81- < div className = 'mb-2 text-gray-600 text-xs' >
82- { new Date ( p . date ) . toLocaleDateString ( 'en-US' , {
83- month : 'short' ,
84- day : 'numeric' ,
85- year : 'numeric' ,
86- } ) }
87- </ div >
88- < h3 className = 'shine-text mb-1 font-medium text-lg leading-tight' > { p . title } </ h3 >
89- < p className = 'mb-3 line-clamp-3 flex-1 text-gray-700 text-sm' > { p . description } </ p >
90- < div className = 'flex items-center gap-2' >
91- < div className = '-space-x-1.5 flex' >
92- { ( p . authors && p . authors . length > 0 ? p . authors : [ p . author ] )
93- . slice ( 0 , 3 )
94- . map ( ( author , idx ) => (
95- < Avatar key = { idx } className = 'size-4 border border-white' >
96- < AvatarImage src = { author ?. avatarUrl } alt = { author ?. name } />
97- < AvatarFallback className = 'border border-white bg-gray-100 text-[10px] text-gray-600' >
98- { author ?. name . slice ( 0 , 2 ) }
99- </ AvatarFallback >
100- </ Avatar >
101- ) ) }
102- </ div >
103- < span className = 'text-gray-600 text-xs' >
104- { ( p . authors && p . authors . length > 0 ? p . authors : [ p . author ] )
105- . slice ( 0 , 2 )
106- . map ( ( a ) => a ?. name )
107- . join ( ', ' ) }
108- { ( p . authors && p . authors . length > 0 ? p . authors : [ p . author ] ) . length > 2 && (
109- < >
110- { ' ' }
111- and{ ' ' }
112- { ( p . authors && p . authors . length > 0 ? p . authors : [ p . author ] ) . length - 2 } { ' ' }
113- other
114- { ( p . authors && p . authors . length > 0 ? p . authors : [ p . author ] ) . length - 2 >
115- 1
116- ? 's'
117- : '' }
118- </ >
119- ) }
120- </ span >
121- </ div >
122- </ div >
123- </ div >
124- </ Link >
125- )
126- } ) }
127- </ div >
64+ < PostGrid posts = { posts } />
12865
12966 { totalPages > 1 && (
13067 < div className = 'mt-10 flex items-center justify-center gap-3' >
0 commit comments