-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
67 lines (65 loc) · 1.77 KB
/
Copy pathindex.js
File metadata and controls
67 lines (65 loc) · 1.77 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
import styles from './TwoColumn.module.scss';
import ButtonLink from '@/components/buttons/ButtonLink';
import Container from '@/components/containers/Container';
import Image from 'next/image';
import { combineClasses } from '@/utils/classnames';
export default function TwoColumn({
image,
altTag,
title,
content,
rowOrder,
color,
bgColor,
link,
customBtnClass,
customInnerClass,
linkText = 'Learn more',
secondTextColumn,
openNewTab,
}) {
const styleProps = {
wrapper: {
color,
backgroundColor: bgColor,
},
container: {
flexDirection: rowOrder,
},
};
// Add rowOrder="row-reverse" prop to the component to reverse its order on desktop
return (
<section className={styles.wrapper} style={styleProps.wrapper}>
<Container
className={combineClasses(styles.inner, customInnerClass, styles)}
styles={styleProps.container}
>
<div className={styles.inner__content}>
{title && <h2 className={styles.title}>{title}</h2>}
<div className={styles.content}>{content}</div>
{link && (
<ButtonLink
link={link}
customBtnClass={customBtnClass}
openNewTab={openNewTab}
>
{linkText}
</ButtonLink>
)}
</div>
{secondTextColumn ||
(image && (
<div className={styles.inner__image}>
<Image
className={styles.img}
src={image}
alt={altTag}
fill
sizes='(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw'
/>
</div>
))}
</Container>
</section>
);
}