| import { Calendar, User, Clock, Tag, BookOpen, Quote } from "lucide-react"; | |
| import { MathRenderer } from "./MathRenderer"; | |
| interface AcademicPreviewProps { | |
| title: string; | |
| abstract: string; | |
| body: string; | |
| tags: string[]; | |
| authorName?: string; | |
| show: boolean; | |
| } | |
| export function AcademicPreview({ | |
| title, | |
| abstract, | |
| body, | |
| tags, | |
| authorName = "Your Name", | |
| show, | |
| }: AcademicPreviewProps) { | |
| if (!show) return null; | |
| const hasContent = title || abstract || body; | |
| return ( | |
| <div className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl border border-gray-100 dark:border-gray-700 p-6 sm:p-8 sticky top-24 font-serif"> | |
| {/* Header bar */} | |
| <div className="flex items-center justify-between mb-6 pb-4 border-b border-gray-200 dark:border-gray-700"> | |
| <div className="flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400"> | |
| <BookOpen className="w-4 h-4" /> | |
| <span>IE Blog • Preprint</span> | |
| </div> | |
| <span className="text-xs px-2 py-0.5 bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300 rounded-full font-sans"> | |
| Preview | |
| </span> | |
| </div> | |
| {!hasContent ? ( | |
| <div className="text-center py-16 text-gray-400 dark:text-gray-500"> | |
| <Quote className="w-12 h-12 mx-auto mb-3 opacity-20" /> | |
| <p className="font-sans text-sm">Start writing to see your article preview</p> | |
| </div> | |
| ) : ( | |
| <article className="space-y-6"> | |
| {title && ( | |
| <h1 className="text-3xl font-bold text-gray-900 dark:text-white leading-tight"> | |
| {title} | |
| </h1> | |
| )} | |
| <div className="flex flex-wrap items-center gap-4 text-sm text-gray-500 dark:text-gray-400 font-sans"> | |
| <span className="flex items-center gap-1"> | |
| <User className="w-4 h-4" /> | |
| {authorName} | |
| </span> | |
| <span className="flex items-center gap-1"> | |
| <Calendar className="w-4 h-4" /> | |
| {new Date().toLocaleDateString("en-US", { | |
| year: "numeric", | |
| month: "long", | |
| day: "numeric", | |
| })} | |
| </span> | |
| {body && ( | |
| <span className="flex items-center gap-1"> | |
| <Clock className="w-4 h-4" /> | |
| ~{Math.ceil(body.replace(/<[^>]*>/g, "").split(/\s+/).length / 200)} min read | |
| </span> | |
| )} | |
| </div> | |
| {abstract && ( | |
| <div className="bg-gray-50 dark:bg-gray-900/50 rounded-xl p-4 border-l-4 border-primary"> | |
| <h2 className="text-sm font-semibold uppercase tracking-wider text-primary mb-2 font-sans"> | |
| Abstract | |
| </h2> | |
| <p className="text-gray-700 dark:text-gray-300 leading-relaxed text-[0.95rem]"> | |
| {abstract} | |
| </p> | |
| </div> | |
| )} | |
| {tags.length > 0 && ( | |
| <div className="flex flex-wrap gap-2 font-sans"> | |
| {tags.map((tag) => ( | |
| <span | |
| key={tag} | |
| className="inline-flex items-center gap-1 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 px-3 py-1 rounded-full text-xs" | |
| > | |
| <Tag className="w-3 h-3" /> | |
| {tag} | |
| </span> | |
| ))} | |
| </div> | |
| )} | |
| {body && ( | |
| <div className="prose prose-slate dark:prose-invert max-w-none text-[1rem] leading-relaxed"> | |
| <MathRenderer content={body} /> | |
| </div> | |
| )} | |
| {title && ( | |
| <div className="mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 font-sans text-xs text-gray-400 dark:text-gray-500"> | |
| <p className="font-semibold mb-1">How to cite (APA):</p> | |
| <p className="italic"> | |
| {authorName}. ({new Date().getFullYear()}). <span className="font-medium">{title || "Untitled"}</span>. <span className="underline">IE Blog</span>. | |
| </p> | |
| </div> | |
| )} | |
| </article> | |
| )} | |
| </div> | |
| ); | |
| } |
Xet Storage Details
- Size:
- 4.16 kB
- Xet hash:
- 0d544bd6c121853eee975e633f8ba174e09e2bbcae99b6142c33d5c8ddc0b159
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.