style: redesign post list component layout

This commit is contained in:
Rico
2026-01-07 19:23:54 +01:00
parent c1dd5ee609
commit 6c2b99d3fe

View File

@@ -1,28 +1,54 @@
@use('Carbon\Carbon') @use('Carbon\Carbon')
<div class="container flex flex-col items-center justify-center p-4 mx-auto mt-3"> <div class="container flex flex-col items-center justify-center p-4 mx-auto mt-3">
<div class="grid w-full grid-cols-1 gap-12 md:grid-cols-2 auto-cols-max"> <div class="grid w-full grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-2 items-stretch">
@foreach ($posts as $post) @foreach ($posts as $post)
@if ($post->hidden) @if ($post->hidden)
@continue @continue
@endif @endif
<article <article class="flex flex-col h-full overflow-hidden transition-colors duration-300 border shadow-md group bg-stone-800/40 rounded-2xl border-stone-800 hover:border-orange-500/30">
class="relative items-center inline-block text-gray-200 border shadow-md bg-stone-800/40 rounded-2xl border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10 h-80"> <!-- Image Wrapper -->
<span class="absolute px-1 py-1 text-sm font-medium text-gray-100 rounded-lg top-4 left-4 bg-black/60"> <a href="{{ route('posts.show', $post->slug) }}" class="relative w-full overflow-hidden aspect-[1.91/1] block">
<abbr itemprop="datePublished">{{ Carbon::parse($post->date)->format('F d, Y') }}</abbr> <img
</span> src="{{ $post->thumbnail }}"
<img src="{{ $post->thumbnail }}" alt="Post Thumbnail" alt="{{ $post->title }} Thumbnail"
class="object-cover w-full h-48 aspect-video rounded-t-2xl"> class="object-cover w-full h-full"
<div class="p-4"> >
<h2 class="mb-2 text-xl font-bold line-clamp-1" itemprop="name">{{ $post->title }}</h2> </a>
<p class="text-sm line-clamp-3" itemprop="headline">{{ $post->description }}</p>
<!-- Content -->
<div class="flex flex-col flex-1 p-5">
<!-- Date -->
<div class="mb-2 text-xs font-medium tracking-wider text-orange-400 uppercase">
<abbr itemprop="datePublished">{{ Carbon::parse($post->date)->format('F d, Y') }}</abbr>
</div>
<!-- Title -->
<a href="{{ route('posts.show', $post->slug) }}" class="block group-hover:text-orange-400 transition-colors duration-200">
<h2 class="mb-3 text-xl font-bold leading-tight text-gray-100 line-clamp-2" itemprop="name">
{{ $post->title }}
</h2>
</a>
<!-- Description -->
<p class="mb-4 text-sm leading-relaxed text-gray-400 line-clamp-3" itemprop="headline">
{{ $post->description }}
</p>
<!-- Footer / Action -->
<div class="mt-auto pt-4 border-t border-stone-700/50 flex items-center justify-between">
<a href="{{ route('posts.show', $post->slug) }}" itemprop="url" class="inline-flex items-center text-sm font-medium text-orange-400 transition-colors group-hover:text-orange-300">
Read Article
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-1 transition-transform duration-300 group-hover:translate-x-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
</svg>
</a>
</div>
</div> </div>
<a href="{{ route('posts.show', $post->slug) }}" itemprop="url"
class="absolute text-sm text-orange-400 bottom-4 right-4 hover:text-orange-600">Read more</a>
</article> </article>
@endforeach @endforeach
</div> </div>
<div class="mt-4"> <div class="mt-8">
{{ $posts->links() }} {{ $posts->links() }}
</div> </div>
</div> </div>