Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/alexfts/hacking-for-humanity
- Loading branch information
Showing
6 changed files
with
105 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,48 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { Button } from '@material-ui/core'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import styles from './styles'; | ||
import React, { useState } from 'react'; | ||
import { withStyles, Grid, Slide, Typography } from '@material-ui/core'; | ||
|
||
import funFacts from '../../data/funfacts.json'; | ||
import Loader from '../Loader'; | ||
import QuoteIcon from '@material-ui/icons/FormatQuote'; | ||
import styles from './styles'; | ||
|
||
const FunFacts = ({ location, classes }) => { | ||
const litter = location.state && location.state.litter; | ||
const name = location.state && location.state.name; | ||
const pathname = location.state && location.state.pathname; | ||
var Random = funFacts.facts[Math.floor(Math.random() * 13)]; | ||
|
||
const [litterState] = useState(true); | ||
|
||
return ( | ||
<div className={classes.factContainer}> | ||
<h1 className={classes.title}>Fun Fact!</h1> | ||
<Grid | ||
container | ||
direction="column" | ||
alignItems="center" | ||
justify="space-between" | ||
className={classes.container} | ||
> | ||
<Grid item xs={12} className={classes.item}> | ||
<Slide in={litterState} direction="down"> | ||
<Typography variant="h2" gutterBottom className={classes.header}> | ||
Fun Fact | ||
</Typography> | ||
</Slide> | ||
|
||
<Grid item xs={12} className={classes.item}> | ||
<Slide in={litterState} direction="up"> | ||
<Typography variant="h4" gutterBottom className={classes.fact}> | ||
"{Random}" | ||
</Typography> | ||
</Slide> | ||
</Grid> | ||
|
||
<p className={classes.fact}> | ||
<QuoteIcon /> | ||
{Random} | ||
<QuoteIcon /> | ||
</p> | ||
{litter && name && pathname && ( | ||
<Loader pathname={pathname} litter={litter} name={name} /> | ||
)} | ||
</div> | ||
<Grid item xs={12} className={classes.item}> | ||
{litter && name && pathname && ( | ||
<Loader pathname={pathname} litter={litter} name={name} /> | ||
)} | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; | ||
export default withStyles(styles)(FunFacts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
const styles = theme => ({ | ||
root: { | ||
container: { | ||
flexGrow: 1, | ||
padding: theme.spacing.unit * 5, | ||
height: '100vh' | ||
}, | ||
title: { | ||
textAlign: "center", | ||
color: theme.palette.primary.dark | ||
}, | ||
factContainer: { | ||
height: "100vh", | ||
width: "100%", | ||
display: "flex", | ||
flexDirection: "column", | ||
textAlign: "center", | ||
justifyContent: "center" | ||
}, | ||
fact: { | ||
width: "50%", | ||
margin: "20px auto", | ||
}, | ||
svg: { | ||
fontSize: "20px !important" | ||
} | ||
|
||
item: { | ||
padding: theme.spacing.unit * 3, | ||
textAlign: 'center', | ||
margin: theme.spacing.unit * 10 | ||
}, | ||
header: { | ||
weight: 700, | ||
color: theme.palette.primary.dark, | ||
fontFamily: 'Sofia, cursive' | ||
}, | ||
fact: { maxWidth: 500 }, | ||
svg: { | ||
fontSize: '30px !important' | ||
} | ||
}); | ||
export default styles; | ||
export default styles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters