-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.tsx
59 lines (57 loc) · 1.56 KB
/
index.tsx
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
import ButtonLink from '@/components/buttons/ButtonLink';
import TwoColumnStyles from './styles';
export default function TwoColumn({
image,
altTag,
title,
content,
rowOrder,
color,
bgColor,
link,
customBtnClass,
$btnColorScheme,
linkText = 'Learn more',
secondTextColumn,
openNewTab,
$contentType,
}) {
//Set Styles based on content type
const S = TwoColumnStyles[$contentType]
? TwoColumnStyles[$contentType]
: TwoColumnStyles.base;
// Add rowOrder="row-reverse" prop to the component to reverse its order on desktop
return (
<S.TwoColumnWrapper $color={color} $bgColor={bgColor}>
<S.InnerContainer
$contentType={$contentType}
styles={{ flexDirection: rowOrder }}
>
<S.InnerContent $contentType={$contentType}>
{title && <S.Title $color={color}>{title}</S.Title>}
<S.Content $contentType={$contentType}>{content}</S.Content>
{link && (
<ButtonLink
link={link}
$colorScheme={$btnColorScheme}
openNewTab={openNewTab}
>
{linkText}
</ButtonLink>
)}
</S.InnerContent>
{secondTextColumn && secondTextColumn}
{!secondTextColumn && image && (
<S.InnerImageWrapper $contentType={$contentType}>
<S.InnerImage
$contentType={$contentType}
src={image}
alt={altTag}
fill
/>
</S.InnerImageWrapper>
)}
</S.InnerContainer>
</S.TwoColumnWrapper>
);
}