-
Notifications
You must be signed in to change notification settings - Fork 3
/
Bio.tsx
executable file
·87 lines (78 loc) · 2.21 KB
/
Bio.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import React from "react"
import Img from "gatsby-image"
import {
Card,
CardContent,
CardActions,
Chip,
Grid,
Theme,
createStyles,
withStyles,
WithStyles,
CardActionArea,
} from "@material-ui/core"
// Components
import Text from "components/Typography/Text"
import MarkdownContent from "components/General/MarkdownContent"
// Types
import { BioType } from "hooks/useBios"
const styles = (__: Theme) =>
createStyles({
root: {},
content: {},
title: {},
position: {},
description: {},
action: {},
major: {},
})
type Props = WithStyles<typeof styles> & {
bioData: BioType
}
function Bio(props: Props) {
const { classes, bioData } = props
const { node, image } = bioData
if (!node.frontmatter)
throw new Error("Frontmatter does not exist for node")
const {
name = "Undefined",
position = "Undefined",
majors = [],
} = node.frontmatter
return (
<Card className={classes.root}>
<div className={classes.content}>
<Img fluid={image.childImageSharp?.fluid} />
<CardContent>
<Text
variant="h5"
color="textSecondary"
className={classes.title}
>
{name}
</Text>
<Text variant="subtitle1" className={classes.position}>
{position}
</Text>
<MarkdownContent content={node.html} />
</CardContent>
</div>
<CardActions className={classes.action}>
<Grid
container
justify="center"
alignItems="flex-start"
spacing={1}
>
{majors.map((major: string) => (
<Grid item key={name + major}>
<Chip label={major} color="primary" />
</Grid>
))}
</Grid>
</CardActions>
</Card>
)
}
export default withStyles(styles)(Bio)