import { useBlogPost } from '@components/frontStore/blog/BlogPostContext.js'; import { _ } from '@evershop/evershop/lib/locale/translate/_'; import { ArrowLeft, Calendar, Clock } from 'lucide-react'; import React from 'react'; /** * Blog post block: the back link, the category chip, the title and the meta * line (author, date, reading time). A page component rather than markup inside the `BlogPostView` shell so a theme can move it * from `layouts.json`; it reads `BlogPostProvider`, so it must stay inside the post shell's Areas. */ export default function BlogPostHeader(): React.ReactElement { const post = useBlogPost(); return ( <>
{_('Back to blog')}
{post.category && ( {post.category.name} )}

{post.name}

{post.author?.fullName && {post.author.fullName}} {post.publishedAt && ( {new Date(post.publishedAt).toLocaleDateString()} )} {post.readingTime ? ( {post.readingTime} {_('min read')} ) : null}
); } export const layout = { areaId: 'blogPostArticle', sortOrder: 10 };