This repository was archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathHeroWithOneButton.js
More file actions
109 lines (103 loc) · 2.67 KB
/
HeroWithOneButton.js
File metadata and controls
109 lines (103 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { Box, Container, Typography, makeStyles } from '@material-ui/core';
const useStyles = makeStyles(theme => ({
root: {
minHeight: '350px',
color: '#FFF',
padding: '127px 70px',
[theme.breakpoints.down('md')]: {
paddingLeft: 15,
paddingRight: 15
}
},
main: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '0px',
color: '#FFF'
},
btn: {
backgroundColor: '#A60000',
color: '#ffffff',
textTransform: 'capitalize',
[theme.breakpoints.down('sm')]: {
width: '100%'
},
'&:hover': {
backgroundColor: 'rgba(166, 0, 0, 0.8)'
}
}
}));
function Hero({
title,
subtitle,
subtitleDesign,
className,
backgroundImage = null,
component = null,
...rest
}) {
const classes = useStyles();
return (
<div>
{backgroundImage ? (
<div
className={clsx(classes.root, className)}
style={{
backgroundImage: `${backgroundImage}`,
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
backgroundPositionY: 'center',
backgroundPositionX: 'center'
}}
{...rest}
>
<Container maxWidth="lg">
<div className={classes.main}>
<Typography align="center" variant="h2">
{title}
</Typography>
<Box mt={2}>
<Typography
className={subtitleDesign}
variant="body1"
align="center"
>
{subtitle}
</Typography>
</Box>
<Box mt={2}>{component != null ? component : <></>}</Box>
</div>
</Container>
</div>
) : (
<div className={clsx(classes.root, className)} {...rest}>
<Container maxWidth="lg">
<div className={classes.main}>
<Typography variant="h1">{title}</Typography>
<Box mt={2}>
<Typography variant="body1" align="center">
{subtitle}
</Typography>
</Box>
<Box mt={2}>{component != null ? component : <></>}</Box>
</div>
</Container>
</div>
)}
</div>
);
}
Hero.propTypes = {
title: PropTypes.string,
subtitle: PropTypes.string,
subtitleDesign: PropTypes.string,
className: PropTypes.string,
backgroundImage: PropTypes.string,
component: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
};
export default Hero;