|
| 1 | +import React from 'react'; |
| 2 | +import PropTypes from 'prop-types'; |
| 3 | +import clsx from 'clsx'; |
| 4 | + |
| 5 | +import { Box, Container, Typography, makeStyles } from '@material-ui/core'; |
| 6 | +// import ApplyNowModal from './ApplyNowModal'; |
| 7 | + |
| 8 | +const useStyles = makeStyles(theme => ({ |
| 9 | + root: { |
| 10 | + minHeight: '350px', |
| 11 | + color: '#FFF', |
| 12 | + padding: '100px 70px', |
| 13 | + [theme.breakpoints.down('md')]: { |
| 14 | + paddingLeft: 15, |
| 15 | + paddingRight: 15 |
| 16 | + } |
| 17 | + }, |
| 18 | + main: { |
| 19 | + display: 'flex', |
| 20 | + flexDirection: 'column', |
| 21 | + alignItems: 'center', |
| 22 | + justifyContent: 'center', |
| 23 | + padding: '0px', |
| 24 | + color: '#FFF' |
| 25 | + }, |
| 26 | + btn: { |
| 27 | + backgroundColor: '#A60000', |
| 28 | + color: '#ffffff', |
| 29 | + textTransform: 'capitalize', |
| 30 | + [theme.breakpoints.down('sm')]: { |
| 31 | + width: '100%' |
| 32 | + }, |
| 33 | + '&:hover': { |
| 34 | + backgroundColor: 'rgba(166, 0, 0, 0.8)' |
| 35 | + } |
| 36 | + } |
| 37 | +})); |
| 38 | + |
| 39 | +function Hero({ |
| 40 | + title, |
| 41 | + subtitle, |
| 42 | + className, // className |
| 43 | + backgroundImage = null, // Link to the background image if any |
| 44 | + component = null, // The Button or any component provided |
| 45 | + ...rest |
| 46 | +}) { |
| 47 | + const classes = useStyles(); |
| 48 | + |
| 49 | + return ( |
| 50 | + <div> |
| 51 | + {backgroundImage ? ( |
| 52 | + <div |
| 53 | + className={clsx(classes.root, className)} |
| 54 | + style={{ |
| 55 | + backgroundImage: `url(${backgroundImage})`, |
| 56 | + backgroundSize: 'cover', |
| 57 | + backgroundRepeat: 'no-repeat' |
| 58 | + }} |
| 59 | + {...rest} |
| 60 | + > |
| 61 | + <Container maxWidth="lg"> |
| 62 | + <div className={classes.main}> |
| 63 | + <Typography variant="h1">{title}</Typography> |
| 64 | + <Box mt={2}> |
| 65 | + <Typography variant="body1" align="center"> |
| 66 | + {subtitle} |
| 67 | + </Typography> |
| 68 | + </Box> |
| 69 | + <Box mt={2}>{component != null ? component : <></>}</Box> |
| 70 | + </div> |
| 71 | + </Container> |
| 72 | + </div> |
| 73 | + ) : ( |
| 74 | + <div className={clsx(classes.root, className)} {...rest}> |
| 75 | + <Container maxWidth="lg"> |
| 76 | + <div className={classes.main}> |
| 77 | + <Typography variant="h1">{title}</Typography> |
| 78 | + <Box mt={2}> |
| 79 | + <Typography variant="body1" align="center"> |
| 80 | + {subtitle} |
| 81 | + </Typography> |
| 82 | + </Box> |
| 83 | + <Box mt={2}>{component != null ? component : <></>}</Box> |
| 84 | + </div> |
| 85 | + </Container> |
| 86 | + </div> |
| 87 | + )} |
| 88 | + </div> |
| 89 | + ); |
| 90 | +} |
| 91 | + |
| 92 | +Hero.propTypes = { |
| 93 | + title: PropTypes.string, |
| 94 | + subtitle: PropTypes.string, |
| 95 | + className: PropTypes.string, |
| 96 | + backgroundImage: PropTypes.string, |
| 97 | + component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) |
| 98 | +}; |
| 99 | + |
| 100 | +export default Hero; |
0 commit comments