Skip to content

Commit c7078f3

Browse files
committed
feat(layout): add layout PostLayout
1 parent dfcd6d3 commit c7078f3

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/layouts/PostLayout.astro

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
import type { CollectionEntry } from 'astro:content'
3+
4+
import Breadcrumb from '@/components/Breadcrumb.astro'
5+
import PostHeader from '@/components/post/PostHeader.astro'
6+
import siteConfig from '@/configs/site'
7+
import AppLayout from '@/layouts/AppLayout.astro'
8+
9+
interface Props {
10+
frontmatter: CollectionEntry<'leetcode-solutions'>['data']
11+
}
12+
13+
const { frontmatter } = Astro.props
14+
const { author } = siteConfig
15+
---
16+
17+
<AppLayout
18+
headerCssClasses="max-w-5xl"
19+
title={frontmatter.title}
20+
description={frontmatter.title}
21+
keywords={[
22+
...((frontmatter.keywords as string[]) || []),
23+
...((frontmatter.tags as string[]) || []),
24+
]}
25+
author={author.name}
26+
>
27+
<article class="post">
28+
<Breadcrumb items={[{ icon: '', title: frontmatter.title, url: '' }]} />
29+
<PostHeader {...frontmatter} />
30+
<div class="prose p-4 border max-w-5xl">
31+
<slot />
32+
</div>
33+
</article>
34+
</AppLayout>
35+
36+
<style lang="css">
37+
.post {
38+
@apply grid grid-cols-1 mx-auto my-8 p-4 max-w-5xl;
39+
}
40+
</style>

0 commit comments

Comments
 (0)