💂♂️ fixed lint and prittier
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Breadcrumbs } from '@/components/layout/Breadcrumbs';
|
||||
import { getPostBySlug } from '@/lib/markdown';
|
||||
import { Breadcrumbs } from '@/components/layout/Breadcrumbs'
|
||||
import { getPostBySlug } from '@/lib/markdown'
|
||||
|
||||
interface BreadcrumbItem {
|
||||
label: string;
|
||||
href: string;
|
||||
current?: boolean;
|
||||
label: string
|
||||
href: string
|
||||
current?: boolean
|
||||
}
|
||||
|
||||
function formatDirectoryName(name: string): string {
|
||||
@@ -12,34 +12,34 @@ function formatDirectoryName(name: string): string {
|
||||
tech: 'Tehnologie',
|
||||
design: 'Design',
|
||||
tutorial: 'Tutoriale',
|
||||
};
|
||||
}
|
||||
|
||||
return directoryNames[name] || name.charAt(0).toUpperCase() + name.slice(1);
|
||||
return directoryNames[name] || name.charAt(0).toUpperCase() + name.slice(1)
|
||||
}
|
||||
|
||||
export default async function BlogPostBreadcrumb({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string[] }>;
|
||||
params: Promise<{ slug: string[] }>
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const slugPath = slug.join('/');
|
||||
const post = getPostBySlug(slugPath);
|
||||
const { slug } = await params
|
||||
const slugPath = slug.join('/')
|
||||
const post = getPostBySlug(slugPath)
|
||||
|
||||
const items: BreadcrumbItem[] = [
|
||||
{
|
||||
label: 'Blog',
|
||||
href: '/blog',
|
||||
},
|
||||
];
|
||||
]
|
||||
|
||||
if (slug.length > 1) {
|
||||
for (let i = 0; i < slug.length - 1; i++) {
|
||||
const segmentPath = slug.slice(0, i + 1).join('/');
|
||||
const segmentPath = slug.slice(0, i + 1).join('/')
|
||||
items.push({
|
||||
label: formatDirectoryName(slug[i]),
|
||||
href: `/blog/${segmentPath}`,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default async function BlogPostBreadcrumb({
|
||||
label: post ? post.frontmatter.title : slug[slug.length - 1],
|
||||
href: `/blog/${slugPath}`,
|
||||
current: true,
|
||||
});
|
||||
})
|
||||
|
||||
return <Breadcrumbs items={items} />;
|
||||
return <Breadcrumbs items={items} />
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Breadcrumbs } from '@/components/layout/Breadcrumbs';
|
||||
import { Breadcrumbs } from '@/components/layout/Breadcrumbs'
|
||||
|
||||
export default function BlogBreadcrumb() {
|
||||
return (
|
||||
@@ -11,5 +11,5 @@ export default function BlogBreadcrumb() {
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user