Skip to content

Commit

Permalink
feat: Convert the Works page to FC #30
Browse files Browse the repository at this point in the history
  • Loading branch information
roottool committed Jan 7, 2022
1 parent a556326 commit 1cd67f4
Showing 1 changed file with 40 additions and 51 deletions.
91 changes: 40 additions & 51 deletions src/Pages/Works/index.tsx
@@ -1,16 +1,39 @@
import Button from '@material-ui/core/Button'
import Card from '@material-ui/core/Card'
import CardActions from '@material-ui/core/CardActions'
import CardContent from '@material-ui/core/CardContent'
import Grid from '@material-ui/core/Grid'
import Typography from '@material-ui/core/Typography'
import { withStyles, WithStyles, createStyles } from '@material-ui/core/styles'
import React, { Component } from 'react'
import { Button, Card, CardActions, CardContent, Grid, Typography } from '@material-ui/core'
import { createStyles, withStyles, type WithStyles } from '@material-ui/core/styles'
import { Helmet } from 'react-helmet'

import PageTitleWrapper from '../../Components/atoms/PageTitleWrapper'
import contents from './WorksContents.json'

const Works = ({ classes }: WithStyles<typeof styleSettings>) => (
<div>
<PageTitleWrapper>Works</PageTitleWrapper>
<Grid container className={classes.container}>
{contents.map((item, key) => (
<Grid key={key} item className={classes.cardGrid} md={4} sm={6} xs={12}>
<Card className={classes.card}>
<CardContent>
<Typography gutterBottom variant="h6">
{item.title}
</Typography>
<Typography variant="subtitle1">
{item.tools}
<br />
{item.text}
</Typography>
<CardActions>
<Button className={classes.sourceLink} color="primary" href={item.href}>
ソースコード
</Button>
</CardActions>
</CardContent>
</Card>
</Grid>
))}
</Grid>
</div>
)

const styleSettings = () =>
createStyles({
card: {
Expand All @@ -29,47 +52,13 @@ const styleSettings = () =>
},
})

const sourceCodeLinkLabel = 'ソースコード'

class Works extends Component<WithStyles<typeof styleSettings>> {
constructor(props: WithStyles<typeof styleSettings>) {
super(props)
}

public render() {
const { classes } = this.props
return (
<div>
<Helmet>
<title>Works - roottool&apos;s Portfolio Site</title>
</Helmet>
<PageTitleWrapper>Works</PageTitleWrapper>
<Grid container className={classes.container}>
{contents.map((item, key) => (
<Grid key={key} item className={classes.cardGrid} md={4} sm={6} xs={12}>
<Card className={classes.card}>
<CardContent>
<Typography gutterBottom variant="h6">
{item.title}
</Typography>
<Typography variant="subtitle1">
{item.tools}
<br />
{item.text}
</Typography>
<CardActions>
<Button className={classes.sourceLink} color="primary" href={item.href}>
{sourceCodeLinkLabel}
</Button>
</CardActions>
</CardContent>
</Card>
</Grid>
))}
</Grid>
</div>
)
}
}
const Container = ({ classes }: WithStyles<typeof styleSettings>) => (
<>
<Helmet>
<title>Works - roottool&apos;s Portfolio Site</title>
</Helmet>
<Works classes={classes} />
</>
)

export default withStyles(styleSettings)(Works)
export default withStyles(styleSettings)(Container)

0 comments on commit 1cd67f4

Please sign in to comment.