|
| 1 | +import { Image } from '@/components/mdx' |
| 2 | +import { MdOutlineCalendarToday, MdPeopleOutline } from 'react-icons/md' |
| 3 | + |
1 | 4 | import { formatDate } from '@/lib/date-formatting'
|
2 | 5 | import { getAllPostsIds, getPostData } from '@/lib/posts'
|
3 | 6 | import {
|
4 | 7 | Avatar,
|
5 |
| - AvatarGroup, |
6 |
| - Box, |
7 |
| - Center, |
| 8 | + Container, |
8 | 9 | Flex,
|
9 | 10 | Heading,
|
10 | 11 | Icon,
|
11 |
| - Image, |
| 12 | + Stack, |
12 | 13 | Text,
|
| 14 | + Wrap, |
| 15 | + WrapItem, |
13 | 16 | } from '@chakra-ui/react'
|
14 | 17 | import fs from 'fs'
|
15 | 18 | import matter from 'gray-matter'
|
16 | 19 | import path from 'path'
|
17 |
| -import { MdCalendarToday } from 'react-icons/md' |
18 | 20 |
|
19 | 21 | const Card = ({ frontmatter, id }) => {
|
20 |
| - const boxBackground = 'white !important' |
21 |
| - const iconColor = 'brand.200' |
| 22 | + const boxBackground = 'gray.300' |
22 | 23 | const date = new Date(frontmatter.date)
|
23 | 24 |
|
24 | 25 | return (
|
25 |
| - <Center mt={40} id='post'> |
26 |
| - <Flex |
27 |
| - borderRadius='20px' |
28 |
| - bg={boxBackground} |
29 |
| - w={{ base: '900px', md: '930px' }} |
30 |
| - direction='column' |
31 |
| - justify='space-between' |
32 |
| - > |
33 |
| - <Box p='20px'> |
34 |
| - <Flex w='100%' mb='10px'> |
| 26 | + <Container |
| 27 | + my={20} |
| 28 | + id='post' |
| 29 | + sx={{ bg: boxBackground, color: 'invert' }} |
| 30 | + maxW={{ base: '900px', md: '930px' }} |
| 31 | + > |
| 32 | + <Flex direction='column' fontSize={'2xl'}> |
| 33 | + <Stack direction={'row'} spacing={8} justify='space-between'> |
| 34 | + <Stack> |
| 35 | + <Text my={8} fontWeight={'bold'} opacity={0.5}> |
| 36 | + xarray.dev / blog |
| 37 | + </Text> |
| 38 | + </Stack> |
| 39 | + <Flex |
| 40 | + direction={'row'} |
| 41 | + alignItems={'center'} |
| 42 | + justify={'right'} |
| 43 | + align={'right'} |
| 44 | + > |
35 | 45 | <Image
|
| 46 | + justify={'right'} |
| 47 | + align={'right'} |
| 48 | + w={40} |
36 | 49 | src={'/dataset-diagram-logo.png'}
|
37 | 50 | alt={'xarray logo'}
|
38 |
| - me={'auto'} |
39 |
| - ></Image> |
40 |
| - </Flex> |
41 |
| - <Box> |
42 |
| - <Heading as={'h1'} size='xl'> |
43 |
| - {frontmatter.title} |
44 |
| - </Heading> |
45 |
| - </Box> |
46 |
| - </Box> |
47 |
| - |
48 |
| - <Flex |
49 |
| - mt='auto' |
50 |
| - justify='space-between' |
51 |
| - w='100%' |
52 |
| - align='center' |
53 |
| - borderBottomLeftRadius='inherit' |
54 |
| - borderBottomRightRadius='inherit' |
55 |
| - height='100%' |
56 |
| - direction='row' |
57 |
| - p='20px' |
58 |
| - > |
59 |
| - <Flex me='25px'> |
60 |
| - <Icon |
61 |
| - as={MdCalendarToday} |
62 |
| - w='20px' |
63 |
| - h='20px' |
64 |
| - me='6px' |
65 |
| - color='white.500' |
66 | 51 | />
|
67 |
| - <Text fontWeight={'600'} fontSize={'xl'}> |
68 |
| - {formatDate(date)} |
69 |
| - </Text> |
70 | 52 | </Flex>
|
| 53 | + </Stack> |
| 54 | + <Heading as={'h1'} size={'2xl'} my={8}> |
| 55 | + {frontmatter.title} |
| 56 | + </Heading> |
| 57 | + |
| 58 | + <Stack direction={'row'} my={4} align={'center'}> |
| 59 | + <Icon as={MdOutlineCalendarToday} w='8' h='8' /> |
| 60 | + <Text>{formatDate(date)}</Text> |
| 61 | + </Stack> |
| 62 | + |
| 63 | + <Stack direction={'row'} my={4} align={'center'}> |
| 64 | + <Icon as={MdPeopleOutline} w='8' h='8' /> |
71 | 65 |
|
72 |
| - <AvatarGroup size='md' max={4} color={iconColor}> |
| 66 | + <Wrap spacing={3} my={8}> |
73 | 67 | {frontmatter.authors.map((author) => {
|
74 | 68 | return (
|
75 |
| - <Avatar |
76 |
| - key={author.name} |
77 |
| - src={`https://github.com/${author.github}.png`} |
78 |
| - name={author.name} |
79 |
| - mt={1} |
80 |
| - fontWeight={'600'} |
81 |
| - /> |
| 69 | + <WrapItem key={author.name}> |
| 70 | + <Flex align={'center'} direction={'column'}> |
| 71 | + <Avatar |
| 72 | + src={`https://github.com/${author.github}.png`} |
| 73 | + name={author.name} |
| 74 | + size={'lg'} |
| 75 | + /> |
| 76 | + <Text fontWeight={'bold'} fontSize={'md'}> |
| 77 | + {author.name} |
| 78 | + </Text> |
| 79 | + </Flex> |
| 80 | + </WrapItem> |
82 | 81 | )
|
83 | 82 | })}
|
84 |
| - </AvatarGroup> |
85 |
| - </Flex> |
| 83 | + </Wrap> |
| 84 | + </Stack> |
86 | 85 | </Flex>
|
87 |
| - </Center> |
| 86 | + </Container> |
88 | 87 | )
|
89 | 88 | }
|
90 | 89 |
|
|
0 commit comments