2020-07-13 14:47:30 +00:00
|
|
|
import React from "react"
|
2020-07-13 17:04:46 +00:00
|
|
|
import PropTypes from "prop-types"
|
|
|
|
import classnames from "classnames"
|
2020-07-13 14:47:30 +00:00
|
|
|
|
|
|
|
import { makeStyles } from "@material-ui/core/styles"
|
|
|
|
|
|
|
|
const useStyles = makeStyles(theme => ({
|
|
|
|
section: {
|
|
|
|
padding: "3rem 1.5rem",
|
2020-07-13 17:04:46 +00:00
|
|
|
"&.is-primary": {
|
|
|
|
backgroundColor: theme.palette.primary.main,
|
|
|
|
},
|
2020-07-13 14:47:30 +00:00
|
|
|
[theme.breakpoints.up("md")]: {
|
|
|
|
padding: "6rem 1.5rem",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2020-07-13 17:04:46 +00:00
|
|
|
export const BG_COLOR = {
|
|
|
|
TRANSPARENT: "transparent",
|
|
|
|
PRIMARY: "primary",
|
|
|
|
}
|
|
|
|
|
|
|
|
function Section({ children, className, bgColor }) {
|
2020-07-13 14:47:30 +00:00
|
|
|
const classes = useStyles()
|
2020-07-13 17:04:46 +00:00
|
|
|
return (
|
|
|
|
<section
|
|
|
|
className={classnames(classes.section, className, {
|
|
|
|
"is-primary": bgColor === BG_COLOR.PRIMARY,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
Section.defaultProps = {
|
|
|
|
bgColor: BG_COLOR.TRANSPARENT,
|
|
|
|
}
|
|
|
|
|
|
|
|
Section.propTypes = {
|
|
|
|
bgColor: PropTypes.oneOf(Object.values(BG_COLOR)).isRequired,
|
2020-07-13 14:47:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Section
|