forked from chakra-ui/chakra-ui-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.tsx
43 lines (38 loc) · 1017 Bytes
/
blog.tsx
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
import { Avatar, Box, HStack, Text } from '@chakra-ui/react'
import * as React from 'react'
import MDXLayout from './mdx'
interface BlogLayoutProps {
frontmatter: any
children: React.ReactNode
}
export default function BlogLayout(props: BlogLayoutProps) {
const { frontmatter, children } = props
if (!frontmatter) return <></>
const { publishedDate = {}, authorData: data = {} } = frontmatter
return (
<MDXLayout frontmatter={frontmatter}>
<HStack mt='8' mb='4'>
<Avatar size='md' src={data.avatar_url} />
<Box>
<Text fontWeight='bold' fontSize='sm'>
{data.name}
</Text>
<Text fontSize='xs'>
<a href={data.url}>{data.login}</a>
</Text>
</Box>
</HStack>
<Box
as='time'
dateTime={publishedDate.iso}
color='gray.500'
fontSize='sm'
display='block'
mb='16'
>
{publishedDate.text}
</Box>
{children}
</MDXLayout>
)
}