fix(blog): represent absent article imagery honestly
Deploy Canina / deploy (push) Successful in 3m12s
Deploy Canina / deploy (push) Successful in 3m12s
This commit is contained in:
1 parent
5642c1609c
commit
18094f91a6
17 files changed
+208
-24
No files matched your search
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { BookOpen, Calendar, Eye, MessageSquare, ArrowLeft } from "lucide-react";
|
||||
import { motion } from "motion/react";
|
||||
import SafeImage from "./SafeImage";
|
||||
import BlogImage from "./BlogImage";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import api, { BASE_DOMAIN } from "../lib/services/api";
|
||||
import { toPersian } from "../lib/utils";
|
||||
@@ -104,11 +104,12 @@ export default function BlogPreviewSection() {
|
||||
) : (
|
||||
<div className="flex md:grid md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-8 overflow-x-auto md:overflow-visible pb-4 md:pb-0 micro-hscroll -mx-4 px-4 md:mx-0 md:px-0 select-none snap-x snap-mandatory md:snap-none overscroll-x-contain">
|
||||
{blogs.map((blog, idx) => {
|
||||
const image = blog.imageUrl?.startsWith("http")
|
||||
? blog.imageUrl
|
||||
: blog.imageUrl
|
||||
? `${BASE_DOMAIN}${blog.imageUrl}`
|
||||
: "/assets/images/blog-placeholder.png";
|
||||
const imageUrl = blog.imageUrl?.trim();
|
||||
const image = imageUrl?.startsWith("http")
|
||||
? imageUrl
|
||||
: imageUrl
|
||||
? `${BASE_DOMAIN}${imageUrl}`
|
||||
: "";
|
||||
|
||||
const authorName = resolveBlogAuthor(blog.author);
|
||||
|
||||
@@ -126,7 +127,7 @@ export default function BlogPreviewSection() {
|
||||
className="bg-medical-gray-50/60 rounded-[1.5rem] sm:rounded-[2rem] border border-medical-gray-100 overflow-hidden hover:shadow-lg hover:-translate-y-1 transition-all flex flex-col group w-full"
|
||||
>
|
||||
<Link href={blogHref} className="block relative aspect-video w-full overflow-hidden bg-medical-gray-100">
|
||||
<SafeImage
|
||||
<BlogImage
|
||||
src={image}
|
||||
alt={blog.title}
|
||||
sizes="(max-width: 768px) 70vw, (max-width: 1200px) 50vw, 33vw"
|
||||
|
||||
Reference in new issue
Block a user