Skip to content

Commit aae7e4e

Browse files
author
Tan Jin Ying
authored
Merge pull request #21 from jinyingtan/Refactor
Refactor
2 parents 23a7342 + f0b8340 commit aae7e4e

39 files changed

+362
-736
lines changed

src/components/header.js renamed to src/components/NavBar.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ const styles = theme => ({
2424
width: '100%',
2525
},
2626
appBar: {
27-
backgroundColor: '#fff',
27+
backgroundColor: 'white',
2828
},
2929
grow: {
3030
flexGrow: 1,
3131
},
3232
links: {
3333
textDecoration: 'none',
34-
color: '#000',
34+
color: 'black',
3535
},
3636
whiteLinks: {
3737
textDecoration: 'none',
38-
color: '#fff',
38+
color: 'white',
3939
},
4040
sectionDesktop: {
4141
display: 'none',
@@ -115,7 +115,7 @@ const NavBoxItem = ({ to, title, classes }) => {
115115
);
116116
};
117117

118-
class Header extends Component {
118+
class NavBar extends Component {
119119
state = {
120120
left: false,
121121
};
@@ -195,7 +195,7 @@ class Header extends Component {
195195
open={this.state.left}
196196
onClose={this.toggleDrawer('left', false)}
197197
>
198-
198+
199199
<div
200200
tabIndex={0}
201201
role="button"
@@ -212,12 +212,12 @@ class Header extends Component {
212212
}
213213
}
214214

215-
Header.propTypes = {
215+
NavBar.propTypes = {
216216
siteTitle: PropTypes.string,
217217
};
218218

219-
Header.defaultProps = {
219+
NavBar.defaultProps = {
220220
siteTitle: '',
221221
};
222222

223-
export default withStyles(styles)(Header);
223+
export default withStyles(styles)(NavBar);

src/components/about/BannerComponent.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import React, { Component } from 'react';
33
import Typography from '@material-ui/core/Typography';
44
import { withStyles } from '@material-ui/core/styles';
55

6-
import BannerImage from '../BannerImage';
6+
import BannerImage from '../commons/BannerImage';
7+
import { whiteSmoke } from '../../utils/Colors'
78

89
const styles = theme => ({
910
root: {
@@ -33,12 +34,12 @@ const styles = theme => ({
3334
marginRight: '2rem'
3435
},
3536
title: {
36-
color: '#f5f5f5',
37+
color: whiteSmoke,
3738
fontWeight: 700
3839
},
3940
description: {
4041
marginTop: '2em',
41-
color: '#f5f5f5'
42+
color: whiteSmoke
4243
}
4344
})
4445

src/components/about/PictureWithNameComponent.js

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/components/about/PictureWithWriteUpComponent.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/components/about/TeamComponent.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React, { Component } from 'react';
22

3-
import { withStyles } from '@material-ui/core/styles';
43
import Typography from '@material-ui/core/Typography';
54
import Grid from '@material-ui/core/Grid';
5+
import { withStyles } from '@material-ui/core/styles';
66

7-
import PictureWithWriteUpComponent from './PictureWithWriteUpComponent'
8-
import PictureWithNameComponent from './PictureWithNameComponent'
7+
import TeamHorizontalCardComponent from './TeamHorizontalCardComponent'
8+
import TeamVerticalCardComponent from './TeamVerticalCardComponent'
99

1010
const styles = theme => ({
1111
root: {
@@ -47,7 +47,7 @@ class TeamComponent extends Component {
4747

4848
return (
4949
partners.map((partner, index) => (
50-
<PictureWithNameComponent
50+
<TeamVerticalCardComponent
5151
name={partner.node.frontmatter.name}
5252
profilePicture={partner.node.frontmatter.profilePicture.relativePath}
5353
club={partner.node.frontmatter.club}
@@ -71,7 +71,7 @@ class TeamComponent extends Component {
7171
<div className={classes.advisors}>
7272
<Typography variant="h5" className={classes.title} gutterBottom>Advisors</Typography>
7373
<div className={classes.advisorsInfo}>
74-
<PictureWithWriteUpComponent
74+
<TeamHorizontalCardComponent
7575
info={advisors}
7676
/>
7777
</div>
@@ -80,7 +80,7 @@ class TeamComponent extends Component {
8080
<div className={classes.operations}>
8181
<Typography variant="h5" className={classes.title} gutterBottom>Operations</Typography>
8282
<div className={classes.advisorsInfo}>
83-
<PictureWithWriteUpComponent
83+
<TeamHorizontalCardComponent
8484
info={operations}
8585
/>
8686
</div>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
import Grid from '@material-ui/core/Grid';
5+
import Typography from '@material-ui/core/Typography';
6+
import { withStyles } from '@material-ui/core/styles';
7+
8+
import Image from '../commons/Image'
9+
10+
const styles = theme => ({
11+
profileImage: {
12+
borderRadius: '50%',
13+
width: '4.5rem',
14+
height: '4.5rem',
15+
[theme.breakpoints.up('md')]: {
16+
width: '5.5rem',
17+
height: '5.5rem'
18+
},
19+
},
20+
name: {
21+
fontWeight: 700,
22+
marginBottom: '0.75em',
23+
marginTop: '1.5em',
24+
[theme.breakpoints.up('sm')]: {
25+
marginBottom: '1.25em',
26+
marginTop: 0
27+
}
28+
},
29+
})
30+
31+
class TeamHorizontalCardComponent extends Component {
32+
createGridItems = (classes, data) => {
33+
const info = data.edges;
34+
35+
return (
36+
info.map((i, index) => (
37+
<Grid item xs={12} sm={6}>
38+
<div className={classes.root}>
39+
<Grid container>
40+
<Grid item sm={4} lg={3}>
41+
<Image filename={i.node.frontmatter.profilePicture.relativePath} classProps={classes.profileImage} />
42+
</Grid>
43+
44+
<Grid item sm={8} lg={9} className={classes.info}>
45+
<Typography variant="body1" className={classes.name}>{i.node.frontmatter.name}</Typography>
46+
<Typography variant="body2" className={classes.title}>{i.node.frontmatter.description}</Typography>
47+
</Grid>
48+
</Grid>
49+
</div>
50+
</Grid>
51+
))
52+
)
53+
}
54+
55+
render() {
56+
const { info } = this.props;
57+
const { classes } = this.props;
58+
59+
return (
60+
<div>
61+
<Grid container spacing={40}>
62+
{this.createGridItems(classes, info)}
63+
</Grid>
64+
</div>
65+
);
66+
}
67+
}
68+
69+
TeamHorizontalCardComponent.propTypes = {
70+
info: PropTypes.object.isRequired
71+
};
72+
73+
export default withStyles(styles)(TeamHorizontalCardComponent);

0 commit comments

Comments
 (0)