-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1388 from hackforla/1347-thematic-coloring-of-con…
…tent-pages-2-v2-new-components #2 v2 new components
- Loading branch information
Showing
4 changed files
with
147 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import Container from '@material-ui/core/Container'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import sharedLayout from '@theme/layout'; | ||
import clsx from 'clsx'; | ||
|
||
// ContentBody keeps the body of all content pages centered | ||
// with a customizable maxWidth container that defaults to 'md'. | ||
|
||
const ContentBody = ({ children, maxWidth, hasTopMargin }) => { | ||
const classes = sharedLayout(); | ||
|
||
return ( | ||
<Grid container className={clsx(hasTopMargin && classes.marginTopLarge)} alignItems="center" justify="center" direction="column"> | ||
<Grid item> | ||
<Container component="main" maxWidth={maxWidth}> | ||
<div> | ||
{children} | ||
</div> | ||
</Container> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; | ||
|
||
ContentBody.defaultProps = { | ||
children: {}, | ||
maxWidth: 'md', | ||
hasTopMargin: true, | ||
}; | ||
|
||
ContentBody.propTypes = { | ||
children: PropTypes.node, | ||
maxWidth: PropTypes.string, | ||
hasTopMargin: PropTypes.bool, | ||
}; | ||
|
||
export default ContentBody; |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
bottomSpacing: { | ||
height: theme.footer.height, | ||
}, | ||
})); | ||
|
||
// ContentBottom is used to provide the necessary amount of bottom margin on | ||
// all content pages to prevent the fixed footer from covering the | ||
// bottom of the content pages. This component is utilized at the bottom of the | ||
// component page <Switch> of Routes.jsx | ||
|
||
const ContentBottom = () => { | ||
const classes = useStyles(); | ||
return ( | ||
<Grid container className={classes.bottomSpacing}> | ||
{/* an empty grid container with footer height to prevent | ||
* fixed positioned footer from obscuring submit button */} | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default ContentBottom; |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Typography from '@material-ui/core/Typography'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
headingBackground: { | ||
background: theme.palette.primary.main, | ||
backgroundPosition: 'top', | ||
height: '20vh', | ||
position: 'relative', | ||
}, | ||
headingOverlayText: { | ||
left: '50%', | ||
color: 'white', | ||
position: 'absolute', | ||
textAlign: 'center', | ||
top: '50%', | ||
transform: 'translate(-50%, -70%)', | ||
}, | ||
contentHeading: { | ||
fontWeight: theme.typography.fontWeightBold, | ||
}, | ||
})); | ||
|
||
// TextHeading provides a standardized heading area and custom title | ||
// below the Header on all content pages. | ||
|
||
const TextHeading = ({ children }) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.headingBackground}> | ||
<div className={classes.headingOverlayText}> | ||
<Typography variant="h3" className={classes.contentHeading}> | ||
<div> | ||
{children} | ||
</div> | ||
</Typography> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
TextHeading.defaultProps = { | ||
children: {}, | ||
}; | ||
|
||
TextHeading.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default TextHeading; |