feat(blog): enhance blog data handling with normalization and improved image management
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import React from "react";
|
||||
import Image from "next/image";
|
||||
import { sanitizeHtml } from "@/lib/sanitize";
|
||||
import { imageUrl } from "@/helper";
|
||||
|
||||
function Caption({ data }) {
|
||||
const imageUrl = data?.images?.[0]?.url;
|
||||
const cover = data?.images?.[0]?.url ? imageUrl(data.images[0].url) : "";
|
||||
|
||||
return (
|
||||
<>
|
||||
{imageUrl && imageUrl.trim() !== "" && (
|
||||
{cover && cover.trim() !== "" && (
|
||||
<div className="relative w-full aspect-video rounded-[8px] overflow-hidden">
|
||||
<Image
|
||||
src={imageUrl}
|
||||
src={cover}
|
||||
alt={data?.title || "blog cover"}
|
||||
fill
|
||||
className="object-cover"
|
||||
|
||||
Reference in New Issue
Block a user