-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathPost.tsx
More file actions
59 lines (41 loc) · 1.6 KB
/
Post.tsx
File metadata and controls
59 lines (41 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import Preview from '@node-core/ui-components/Common/Preview';
import EOLAlert from '#site/components/EOL/EOLAlert';
import WithAvatarGroup from '#site/components/withAvatarGroup';
import WithBlogCrossLinks from '#site/components/withBlogCrossLinks';
import WithFooter from '#site/components/withFooter';
import WithMetaBar from '#site/components/withMetaBar';
import WithNavBar from '#site/components/withNavBar';
import { useClientContext } from '#site/hooks/server';
import { mapAuthorToCardAuthors } from '#site/util/author';
import { mapBlogCategoryToPreviewType } from '#site/util/blog';
import type { FC, PropsWithChildren } from 'react';
import styles from './layouts.module.css';
const PostLayout: FC<PropsWithChildren> = ({ children }) => {
const { frontmatter } = useClientContext();
const authors = mapAuthorToCardAuthors(frontmatter.author!);
const type = mapBlogCategoryToPreviewType(frontmatter.category!);
return (
<>
<WithNavBar />
<div className={styles.contentLayout}>
<div></div>
<div className={styles.postLayout}>
<main id="main" tabIndex={-1}>
{type === 'vulnerability' && <EOLAlert />}
<h1>{frontmatter.title}</h1>
<section>
<WithAvatarGroup names={authors} size="medium" />
<p>{authors.join(', ')}</p>
</section>
<Preview title={frontmatter.title!} type={type} />
{children}
<WithBlogCrossLinks />
</main>
</div>
<WithMetaBar />
</div>
<WithFooter />
</>
);
};
export default PostLayout;