tahamajs/IE / Projects /front /src /components /blog /BlogPostFull.tsx
tahamajs's picture
download
raw
4.91 kB
// src/components/blog/BlogPostFull.tsx
import { ArticleMeta } from "@/components/article/ArticleMeta";
import { ArticleAuthor } from "@/components/article/ArticleAuthor";
import { ArticleTags } from "@/components/article/ArticleTags";
import { ArticleActions } from "@/components/article/ArticleActions";
import { ArticleStats } from "@/components/article/ArticleStats";
import { ShareButtons } from "@/components/common/ShareButtons";
import { TableOfContents } from "@/components/article/TableOfContents";
import { RelatedArticles } from "@/components/article/RelatedArticles";
import { CommentsSection } from "@/components/comments/CommentsSection";
const ShareButtonsAny = ShareButtons as any;
const TableOfContentsAny = TableOfContents as any;
const RelatedArticlesAny = RelatedArticles as any;
const CommentsSectionAny = CommentsSection as any;
interface BlogPostFullProps {
post: {
id: number;
title: string;
content: string;
abstract: string;
coverImage: string;
createdAt: string;
updatedAt: string;
readTime: number;
views: number;
likes: number;
comments: number;
bookmarks: number;
shares: number;
citations: number;
impactScore: number;
tags: string[];
author: any;
tableOfContents?: { id: string; title: string; level: number }[];
relatedArticles?: any[];
};
onLike?: () => void;
onBookmark?: () => void;
onShare?: () => void;
onComment?: () => void;
}
export function BlogPostFull({ post, onLike, onBookmark, onShare, onComment }: BlogPostFullProps) {
return (
<article className="max-w-4xl mx-auto">
{/* Hero Section */}
<div className="relative rounded-3xl overflow-hidden mb-8">
<img
src={post.coverImage}
alt={post.title}
className="w-full h-96 object-cover"
/>
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent" />
<div className="absolute bottom-0 left-0 right-0 p-8 text-white">
<h1 className="text-4xl md:text-5xl font-bold mb-4">{post.title}</h1>
<ArticleMeta
createdAt={post.createdAt}
readTime={post.readTime}
views={post.views}
likes={post.likes}
comments={post.comments}
className="text-white/80"
/>
</div>
</div>
{/* Author & Actions Bar */}
<div className="flex flex-wrap justify-between items-center gap-4 mb-8 pb-4 border-b border-gray-200 dark:border-gray-800">
<ArticleAuthor author={post.author} showBio={false} />
<div className="flex items-center gap-4">
<ArticleActions
articleId={post.id}
likesCount={post.likes}
bookmarksCount={post.bookmarks}
onLike={onLike}
onBookmark={onBookmark}
onShare={onShare}
onComment={onComment}
/>
<ShareButtonsAny url={window.location.href} title={post.title} />
</div>
</div>
{/* Table of Contents */}
{post.tableOfContents && post.tableOfContents.length > 0 && (
<TableOfContentsAny items={post.tableOfContents} className="mb-8" />
)}
{/* Content */}
<div
className="prose prose-lg dark:prose-invert max-w-none mb-8"
dangerouslySetInnerHTML={{ __html: post.content }}
/>
{/* Tags */}
{post.tags && post.tags.length > 0 && (
<div className="mb-8">
<h3 className="text-sm font-semibold mb-3">Topics</h3>
<ArticleTags tags={post.tags} variant="pills" />
</div>
)}
{/* Stats Section */}
<div className="grid md:grid-cols-2 gap-6 mb-8 p-6 bg-gray-50 dark:bg-gray-800/50 rounded-2xl">
<ArticleStats
views={post.views}
likes={post.likes}
comments={post.comments}
bookmarks={post.bookmarks}
shares={post.shares}
citations={post.citations}
impactScore={post.impactScore}
variant="grid"
/>
<div className="space-y-3">
<h3 className="font-semibold">Share this article</h3>
<ShareButtonsAny url={window.location.href} title={post.title} variant="horizontal" />
<p className="text-xs text-gray-500">Help spread this research</p>
</div>
</div>
{/* Author Bio */}
<div className="mb-8 p-6 bg-gray-50 dark:bg-gray-800/50 rounded-2xl">
<ArticleAuthor author={post.author} variant="vertical" showBio showStats showSocial />
</div>
{/* Comments Section */}
<CommentsSectionAny articleId={post.id} commentsCount={post.comments} />
{/* Related Articles */}
{post.relatedArticles && post.relatedArticles.length > 0 && (
<RelatedArticlesAny articles={post.relatedArticles} className="mt-8" />
)}
</article>
);
}

Xet Storage Details

Size:
4.91 kB
·
Xet hash:
cc75243b270e462dee72f3bfa3a541805178e810bf6b2912b0e19b7104b34ed9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.