Repository navigation
Expand file tree
/
Copy pathSectionHeader.js
More file actions
96 lines (91 loc) · 2.47 KB
/
Copy pathSectionHeader.js
File metadata and controls
96 lines (91 loc) · 2.47 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
import React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import styles from './sectionheader.module.css';
const SectionHeader = props => {
const {
title,
subtitle,
label,
overline,
ctaGroup,
fadeUp,
disableGutter,
align,
className,
...rest
} = props;
return (
<section className={clsx(align === 'left' ? styles.headerSectionLeftAlign : styles.headerSection, className ? className : '')}>
<div
className={clsx('container', styles.header, disableGutter ? styles.disableGutter : styles.enableGutter)}
// data-aos={fadeUp ? 'fade-up' : ''}
>
{overline && (
<div className='row'>
<div className={clsx('col', 'col--12', styles.overline)}>{overline}</div>
</div>
)}
{label && (
<div className='row'>
<div className={clsx('col', 'col--12', styles.label)}>{label}</div>
</div>
)}
<div className='row'>
<div className={clsx('col', 'col--12', styles.title)} dangerouslySetInnerHTML={{__html: title}} />
</div>
<div className='row'>
<div className={clsx('col', 'col--12', styles.subtitle)}>{subtitle}</div>
</div>
{ctaGroup && (
<div className='row'>
<div className={clsx('col', 'col--12', 'button-group', align === 'left' ? styles.ctaGroupLeftAlign : styles.ctaGroup)}>{ctaGroup}</div>
</div>
)}
</div>
</section>
);
};
SectionHeader.defaultProps = {
fadeUp: 'fade-up',
align: 'center',
};
SectionHeader.propTypes = {
/**
* External classes
*/
className: PropTypes.string,
/**
* Title of the section header
*/
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
/**
* Subtitle of the section header
*/
subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
/**
* Label title of the section header
*/
label: PropTypes.string,
/**
* The overline component in the section header
*/
overline: PropTypes.node,
/**
* Array of the CTAs
*/
ctaGroup: PropTypes.arrayOf(PropTypes.node),
/**
* Whether to fade up on scroll
*/
fadeUp: PropTypes.bool,
/**
* Header content (title, subtitle, CTAs) alignment
*/
align: PropTypes.oneOf(['right', 'left', 'center']),
/**
* Whether to disable bottom margin of the section
*/
disableGutter: PropTypes.bool,
};
export default SectionHeader;