fix(blog): update fallback image handling, use SafeImage, and enhance related products display
Deploy Canina / deploy (push) Successful in 1m37s
Deploy Canina / deploy (push) Successful in 1m37s
This commit is contained in:
1 parent
fe6a900665
commit
1ddfb0a823
14 files changed
+11087
-9377
No files matched your search
@@ -23,6 +23,7 @@ import { Product } from "../lib/data/products";
|
||||
import { productService } from "../lib/services/productService";
|
||||
import { useRouter } from 'next/navigation';
|
||||
import Image from 'next/image';
|
||||
import SafeImage from './SafeImage';
|
||||
|
||||
export interface BlogCategory {
|
||||
id: string;
|
||||
@@ -240,15 +241,14 @@ export default function BlogPage({
|
||||
className="bg-white rounded-[3.5rem] overflow-hidden border border-medical-gray-200 shadow-2xl flex flex-col lg:flex-row cursor-pointer group hover:border-canina-blue/30 transition-all"
|
||||
onClick={() => router.push(`/blog/${featuredPost.slug}`)}
|
||||
>
|
||||
<div className="lg:w-1/2 aspect-video lg:aspect-auto relative overflow-hidden">
|
||||
<Image
|
||||
<div className="lg:w-1/2 aspect-video lg:aspect-auto relative overflow-hidden bg-medical-gray-100">
|
||||
<SafeImage
|
||||
src={featuredPost.image}
|
||||
alt={featuredPost.imageAlt || featuredPost.title}
|
||||
fill
|
||||
priority
|
||||
sizes="(max-width: 1024px) 100vw, 50vw"
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
|
||||
unoptimized
|
||||
className="w-full h-full"
|
||||
imgClassName="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
|
||||
/>
|
||||
{featuredPost.featured && (
|
||||
<div className="absolute top-6 right-6 px-3.5 py-1.5 bg-amber-500 text-white rounded-full text-xs font-black flex items-center gap-1.5 shadow-lg backdrop-blur-md">
|
||||
@@ -311,17 +311,16 @@ export default function BlogPage({
|
||||
onClick={() => router.push(`/blog/${post.slug}`)}
|
||||
>
|
||||
<div>
|
||||
<div className="aspect-[16/10] overflow-hidden relative">
|
||||
<Image
|
||||
<div className="aspect-[16/10] overflow-hidden relative bg-medical-gray-100">
|
||||
<SafeImage
|
||||
src={post.image}
|
||||
alt={post.imageAlt || post.title}
|
||||
fill
|
||||
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
|
||||
className="w-full h-full object-cover group-hover:scale-108 transition-transform duration-700"
|
||||
unoptimized
|
||||
className="w-full h-full"
|
||||
imgClassName="w-full h-full object-cover group-hover:scale-108 transition-transform duration-700"
|
||||
/>
|
||||
{post.category && (
|
||||
<span className="absolute bottom-3 right-3 px-3 py-1 bg-black/60 backdrop-blur-md text-white rounded-xl text-[10px] font-bold">
|
||||
<span className="absolute bottom-3 right-3 px-3 py-1 bg-black/60 backdrop-blur-md text-white rounded-xl text-[10px] font-bold z-10">
|
||||
{post.category}
|
||||
</span>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user