generated from Silvrbckw/gatsby-ecommerce-theme
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hero.js
44 lines (42 loc) · 1.06 KB
/
Hero.js
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
import React from 'react';
import * as styles from './Hero.module.css';
import Button from '../Button';
import { Link } from 'gatsby';
const Hero = (props) => {
const {
title,
subtitle,
ctaText,
ctaAction,
image,
maxWidth,
ctaStyle,
ctaLink,
ctaTo,
header,
} = props;
return (
<div className={styles.root} style={{ backgroundImage: `url(${image})` }}>
<div className={styles.content} style={{ maxWidth: maxWidth }}>
{header && <span className={styles.header}>{header}</span>}
{title && <h2 className={styles.title}>{title}</h2>}
{subtitle && <span className={styles.subtitle}>{subtitle}</span>}
{ctaText && (
<Button
className={`${styles.ctaButton} ${ctaStyle}`}
level={'primary'}
onClick={ctaAction}
>
{ctaText}
</Button>
)}
{ctaLink && (
<Link className={styles.ctaLink} to={ctaTo}>
{ctaLink}
</Link>
)}
</div>
</div>
);
};
export default Hero;