💂♂️ fixed lint and prittier
This commit is contained in:
@@ -10,10 +10,14 @@ import MarkdownRenderer from '@/components/blog/markdown-renderer'
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const posts = await getAllPosts()
|
||||
return posts.map((post) => ({ slug: post.slug.split('/') }))
|
||||
return posts.map(post => ({ slug: post.slug.split('/') }))
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ slug: string[] }> }): Promise<Metadata> {
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string[] }>
|
||||
}): Promise<Metadata> {
|
||||
const { slug } = await params
|
||||
const slugPath = slug.join('/')
|
||||
const post = getPostBySlug(slugPath)
|
||||
@@ -51,7 +55,10 @@ function extractHeadings(content: string) {
|
||||
while ((match = headingRegex.exec(content)) !== null) {
|
||||
const level = match[1].length
|
||||
const text = match[2]
|
||||
const id = text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '')
|
||||
const id = text
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/(^-|-$)/g, '')
|
||||
headings.push({ id, text, level })
|
||||
}
|
||||
|
||||
@@ -110,7 +117,8 @@ export default async function BlogPostPage({ params }: { params: Promise<{ slug:
|
||||
</h1>
|
||||
|
||||
<p className="text-lg text-[rgb(var(--text-secondary))] leading-relaxed mb-6 font-mono">
|
||||
<span className="text-[var(--neon-pink)]">>></span> {post.frontmatter.description}
|
||||
<span className="text-[var(--neon-pink)]">>></span>{' '}
|
||||
{post.frontmatter.description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -121,9 +129,13 @@ export default async function BlogPostPage({ params }: { params: Promise<{ slug:
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-mono font-bold text-[var(--neon-cyan)] uppercase text-sm">{post.frontmatter.author}</p>
|
||||
<p className="font-mono font-bold text-[var(--neon-cyan)] uppercase text-sm">
|
||||
{post.frontmatter.author}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 text-xs text-[rgb(var(--text-muted))] font-mono">
|
||||
<time className="text-[var(--neon-magenta)]">{formatDate(post.frontmatter.date)}</time>
|
||||
<time className="text-[var(--neon-magenta)]">
|
||||
{formatDate(post.frontmatter.date)}
|
||||
</time>
|
||||
<span className="text-[var(--neon-pink)]">//</span>
|
||||
<span className="text-[var(--neon-cyan)]">{post.readingTime}min READ</span>
|
||||
</div>
|
||||
@@ -147,17 +159,25 @@ export default async function BlogPostPage({ params }: { params: Promise<{ slug:
|
||||
|
||||
{relatedPosts.length > 0 && (
|
||||
<section className="mt-12 pt-8 border-t border-zinc-800">
|
||||
<h2 className="text-2xl font-mono font-bold uppercase text-[var(--neon-cyan)] mb-6">// Articole similare</h2>
|
||||
<h2 className="text-2xl font-mono font-bold uppercase text-[var(--neon-cyan)] mb-6">
|
||||
// Articole similare
|
||||
</h2>
|
||||
<div className="grid gap-6 md:grid-cols-3">
|
||||
{relatedPosts.map((relatedPost) => (
|
||||
{relatedPosts.map(relatedPost => (
|
||||
<Link
|
||||
key={relatedPost.slug}
|
||||
href={`/blog/${relatedPost.slug}`}
|
||||
className="block p-4 border border-zinc-800 bg-zinc-950 hover:border-[var(--neon-cyan)] transition-all hover:shadow-[0_0_8px_rgba(90,139,149,0.2)]"
|
||||
>
|
||||
<h3 className="font-mono font-semibold text-cyan-400 mb-2 line-clamp-2">{relatedPost.frontmatter.title}</h3>
|
||||
<p className="text-sm text-zinc-400 line-clamp-2">{relatedPost.frontmatter.description}</p>
|
||||
<p className="text-xs text-zinc-600 mt-2 font-mono">{formatDate(relatedPost.frontmatter.date)}</p>
|
||||
<h3 className="font-mono font-semibold text-cyan-400 mb-2 line-clamp-2">
|
||||
{relatedPost.frontmatter.title}
|
||||
</h3>
|
||||
<p className="text-sm text-zinc-400 line-clamp-2">
|
||||
{relatedPost.frontmatter.description}
|
||||
</p>
|
||||
<p className="text-xs text-zinc-600 mt-2 font-mono">
|
||||
{formatDate(relatedPost.frontmatter.date)}
|
||||
</p>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
@@ -170,7 +190,12 @@ export default async function BlogPostPage({ params }: { params: Promise<{ slug:
|
||||
className="flex items-center text-[var(--neon-pink)] hover:text-[var(--neon-magenta)] transition-all font-mono text-sm uppercase border border-[var(--neon-pink)] px-4 py-2 hover:shadow-[0_0_6px_rgba(155,90,110,0.3)]"
|
||||
>
|
||||
<svg className="mr-2 w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M15 19l-7-7 7-7"
|
||||
/>
|
||||
</svg>
|
||||
[BACK TO BLOG]
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user