forked from mrwyndham/fastpocket
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import React from "react";
|
|
import Image from "next/image";
|
|
|
|
function BlogContent({ post }: { post: any }) {
|
|
return (
|
|
<div className="lg:mx-0 px-4 lg:px-8 py-12 lg:rounded-lg lg:shadow-lg lg:bg-base-200">
|
|
<h1 className="font-heading text-4xl font-bold text-base-content">
|
|
{post.title}
|
|
</h1>
|
|
<div className="flex items-center gap-2">
|
|
{/* Not sure if name is required */}
|
|
{post?.author && (
|
|
<p className="text-base-content">{post.author ?? ""}</p>
|
|
)}
|
|
{post?.author && <span className="text-base-content">|</span>}
|
|
<p className="text-base-content">
|
|
Last modified {new Date(post.updated).toLocaleDateString()}
|
|
</p>
|
|
</div>
|
|
|
|
<article className="prose prose-img:rounded-xl max-w-none prose-p:text-base-content prose-a:text-primary prose-h2:text-base-content prose-li:text-base-content prose-strong:text-base-content prose-blockquote:pr-2 prose-blockquote:font-normal">
|
|
<div className="h-full w-full">
|
|
<Image
|
|
src={post.imageUrl}
|
|
alt="post-image"
|
|
width={0}
|
|
height={0}
|
|
sizes="100%"
|
|
style={{
|
|
display: "block",
|
|
width: "100%",
|
|
height: "100%",
|
|
objectFit: "cover",
|
|
}}
|
|
/>
|
|
</div>
|
|
<div
|
|
className="w-full max-w-[92vw] overflow-hidden"
|
|
dangerouslySetInnerHTML={{ __html: post.content }}
|
|
></div>
|
|
</article>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default BlogContent;
|