@thecb/components 3.5.4 → 3.5.5-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +401 -635
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +0 -1
- package/src/components/atoms/layouts/Cover.styled.js +1 -0
- package/src/components/atoms/layouts/Imposter.styled.js +1 -0
- package/src/components/molecules/content/Content.js +20 -0
- package/src/components/molecules/content/Content.theme.js +60 -0
- package/src/components/molecules/content/blocks/accordion-block/AccordionBlock.js +108 -0
- package/src/components/molecules/content/blocks/accordion-block/index.js +3 -0
- package/src/components/molecules/content/blocks/article-block/ArticleBlock.js +58 -0
- package/src/components/molecules/content/blocks/article-block/index.js +3 -0
- package/src/components/molecules/content/blocks/attached-file-block/AttachedFileBlock.js +60 -0
- package/src/components/molecules/content/blocks/attached-file-block/index.js +3 -0
- package/src/components/molecules/content/blocks/featured-content-block/FeaturedContentBlock.js +0 -0
- package/src/components/molecules/content/blocks/featured-content-block/index.js +0 -0
- package/src/components/molecules/content/blocks/hero-block/HeroBlock.js +54 -0
- package/src/components/molecules/content/blocks/hero-block/index.js +3 -0
- package/src/components/molecules/content/blocks/highlight-block/HighlightBlock.js +42 -0
- package/src/components/molecules/content/blocks/highlight-block/index.js +3 -0
- package/src/components/molecules/content/blocks/index.js +33 -0
- package/src/components/molecules/content/blocks/info-block/InfoBlock.js +15 -0
- package/src/components/molecules/content/blocks/info-block/index.js +3 -0
- package/src/components/molecules/content/blocks/location-block/LocationBlock.js +228 -0
- package/src/components/molecules/content/blocks/location-block/index.js +3 -0
- package/src/components/molecules/content/blocks/related-links-block/RelatedLinksBlock.js +35 -0
- package/src/components/molecules/content/blocks/related-links-block/index.js +3 -0
- package/src/components/molecules/content/blocks/screendoor-block/ScreendoorBlock.js +57 -0
- package/src/components/molecules/content/blocks/screendoor-block/ScreendoorForm.styled.js +314 -0
- package/src/components/molecules/content/blocks/screendoor-block/index.js +3 -0
- package/src/components/molecules/content/blocks/tagline-block/TaglineBlock.js +45 -0
- package/src/components/molecules/content/blocks/tagline-block/index.js +3 -0
- package/src/components/molecules/content/blocks/task-block/TaskBlock.js +40 -0
- package/src/components/molecules/content/blocks/task-block/index.js +3 -0
- package/src/components/molecules/content/blocks/text-block/TextBlock.js +40 -0
- package/src/components/molecules/content/blocks/text-block/index.js +3 -0
- package/src/components/molecules/content/header/Header.js +283 -0
- package/src/components/molecules/content/header/Header.theme.js +11 -0
- package/src/components/molecules/content/header/index.js +3 -0
- package/src/components/molecules/content/index.js +3 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Stack,
|
|
6
|
+
Cluster,
|
|
7
|
+
Heading,
|
|
8
|
+
Paragraph,
|
|
9
|
+
ButtonWithLink
|
|
10
|
+
} from "@thecb/components";
|
|
11
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
|
|
12
|
+
|
|
13
|
+
const TaskBlock = ({ themeValues, headline, text, callToAction, url }) => (
|
|
14
|
+
<Box
|
|
15
|
+
padding="24px 16px"
|
|
16
|
+
boxShadow={`inset 0px 3px 0px 0px rgb(21, 116, 157),
|
|
17
|
+
0px 2px 4px 0px rgba(41, 42, 51, 0.4);`}
|
|
18
|
+
borderRadius="4px"
|
|
19
|
+
background="#ffffff"
|
|
20
|
+
maxWidth="47.5rem"
|
|
21
|
+
>
|
|
22
|
+
<Stack childGap="1.5rem">
|
|
23
|
+
<Heading
|
|
24
|
+
variant="h3"
|
|
25
|
+
color={themeValues.darkText}
|
|
26
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
27
|
+
>
|
|
28
|
+
{headline}
|
|
29
|
+
</Heading>
|
|
30
|
+
<Paragraph color={themeValues.darkText}>{text}</Paragraph>
|
|
31
|
+
<Box padding="0" minWidth="100%">
|
|
32
|
+
<Cluster justify="flex-end" align="center">
|
|
33
|
+
<ButtonWithLink variant="secondary" url={url} text={callToAction} />
|
|
34
|
+
</Cluster>
|
|
35
|
+
</Box>
|
|
36
|
+
</Stack>
|
|
37
|
+
</Box>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export default TaskBlock;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Stack, Paragraph } from "@thecb/components";
|
|
3
|
+
|
|
4
|
+
const TextBlock = ({
|
|
5
|
+
themeValues,
|
|
6
|
+
textContent = ""
|
|
7
|
+
//variant = "placeholder"
|
|
8
|
+
}) => {
|
|
9
|
+
const paragraphs =
|
|
10
|
+
textContent
|
|
11
|
+
?.split("\n")
|
|
12
|
+
.filter(string => string !== "")
|
|
13
|
+
.map((string, index) => (
|
|
14
|
+
<Box padding="0">
|
|
15
|
+
<Paragraph
|
|
16
|
+
key={`paragraph-${index}`}
|
|
17
|
+
variant="pL"
|
|
18
|
+
color={themeValues.darkText}
|
|
19
|
+
>
|
|
20
|
+
{string}
|
|
21
|
+
</Paragraph>
|
|
22
|
+
</Box>
|
|
23
|
+
)) ?? [];
|
|
24
|
+
return (
|
|
25
|
+
<Box
|
|
26
|
+
minWidth="100%"
|
|
27
|
+
minHeight="500px"
|
|
28
|
+
padding={"32px 24px"}
|
|
29
|
+
background="white"
|
|
30
|
+
>
|
|
31
|
+
<Stack childGap="24px">
|
|
32
|
+
<Box padding="0">
|
|
33
|
+
<Stack>{paragraphs}</Stack>
|
|
34
|
+
</Box>
|
|
35
|
+
</Stack>
|
|
36
|
+
</Box>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default TextBlock;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import React, { useContext, useState, Fragment } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { IoIosArrowRoundForward } from "react-icons/io";
|
|
4
|
+
import {
|
|
5
|
+
Box,
|
|
6
|
+
Cover,
|
|
7
|
+
Cluster,
|
|
8
|
+
Stack,
|
|
9
|
+
Heading,
|
|
10
|
+
Paragraph,
|
|
11
|
+
//Imposter,
|
|
12
|
+
NavHeader,
|
|
13
|
+
//HamburgerButton,
|
|
14
|
+
ExternalLink,
|
|
15
|
+
InternalLink,
|
|
16
|
+
withWindowSize,
|
|
17
|
+
Switcher,
|
|
18
|
+
Motion,
|
|
19
|
+
Center
|
|
20
|
+
} from "@thecb/components";
|
|
21
|
+
import { Helmet } from "react-helmet";
|
|
22
|
+
import { fallbackValues } from "./Header.theme";
|
|
23
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
24
|
+
//import { URL_TEST } from "../../constants/regex_constants";
|
|
25
|
+
import {
|
|
26
|
+
FONT_WEIGHT_SEMIBOLD,
|
|
27
|
+
FONT_WEIGHT_BOLD
|
|
28
|
+
} from "../../../constants/style_constants";
|
|
29
|
+
|
|
30
|
+
const Header = ({ navigation, title, themeValues }) => {
|
|
31
|
+
const { isMobile } = useContext(ThemeContext);
|
|
32
|
+
const [navMenuOpen, setNavMenuOpen] = useState();
|
|
33
|
+
const [selectedNavMenu, setSelectedMenu] = useState(0);
|
|
34
|
+
const [isAnimating, setIsAnimating] = useState();
|
|
35
|
+
const headerLogoSrc =
|
|
36
|
+
"https://cb-public-assets.s3-us-west-2.amazonaws.com/mgw/water-works.png";
|
|
37
|
+
const headerLogoLink = "/cms/home";
|
|
38
|
+
const favicon =
|
|
39
|
+
"https://cb-public-assets.s3-us-west-2.amazonaws.com/mgw/water-works.ico";
|
|
40
|
+
const HeaderLogoWrapper = ({ children }) =>
|
|
41
|
+
headerLogoLink ? (
|
|
42
|
+
false ? (
|
|
43
|
+
<ExternalLink href={headerLogoLink}>{children}</ExternalLink>
|
|
44
|
+
) : (
|
|
45
|
+
<InternalLink to={headerLogoLink}>{children}</InternalLink>
|
|
46
|
+
)
|
|
47
|
+
) : (
|
|
48
|
+
<Fragment>{children}</Fragment>
|
|
49
|
+
);
|
|
50
|
+
const headerLogo = (
|
|
51
|
+
<HeaderLogoWrapper>
|
|
52
|
+
<Box padding="0" minHeight="100%">
|
|
53
|
+
<Cover singleChild minHeight="100%">
|
|
54
|
+
<Box padding="0">
|
|
55
|
+
<img
|
|
56
|
+
src={headerLogoSrc}
|
|
57
|
+
height={isMobile ? "42px" : themeValues.logoHeight}
|
|
58
|
+
alt="header logo"
|
|
59
|
+
/>
|
|
60
|
+
</Box>
|
|
61
|
+
</Cover>
|
|
62
|
+
</Box>
|
|
63
|
+
</HeaderLogoWrapper>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const navLinks = navigation?.sections?.map((link, index) => (
|
|
67
|
+
<Box
|
|
68
|
+
padding="2rem 1.5rem"
|
|
69
|
+
borderColor={navMenuOpen ? themeValues.darkText : "transparent"}
|
|
70
|
+
borderSize="4px"
|
|
71
|
+
borderWidthOverride="0 0 4px 0"
|
|
72
|
+
onClick={() => {
|
|
73
|
+
console.log("i'm getting called!");
|
|
74
|
+
setSelectedMenu(index);
|
|
75
|
+
setNavMenuOpen(!navMenuOpen);
|
|
76
|
+
setIsAnimating(true);
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
setIsAnimating(false);
|
|
79
|
+
}, 600);
|
|
80
|
+
}}
|
|
81
|
+
onMouseEnter={() => {
|
|
82
|
+
if (navMenuOpen !== true) {
|
|
83
|
+
setSelectedMenu(index);
|
|
84
|
+
setNavMenuOpen(true);
|
|
85
|
+
setIsAnimating(true);
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
setIsAnimating(false);
|
|
88
|
+
}, 600);
|
|
89
|
+
} else if (selectedNavMenu !== index) {
|
|
90
|
+
setSelectedMenu(index);
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
<Heading variant="h5" color={themeValues.darkText}>
|
|
95
|
+
{link?.name}
|
|
96
|
+
</Heading>
|
|
97
|
+
</Box>
|
|
98
|
+
));
|
|
99
|
+
|
|
100
|
+
const navLinksContainer = (
|
|
101
|
+
<Box padding="0" minWidth="100%">
|
|
102
|
+
<Cluster justify="space-between" align="stretch">
|
|
103
|
+
<Box padding="1.5rem">{headerLogo}</Box>
|
|
104
|
+
{navLinks}
|
|
105
|
+
</Cluster>
|
|
106
|
+
</Box>
|
|
107
|
+
);
|
|
108
|
+
console.log("navigation in header is", navigation);
|
|
109
|
+
const navItems =
|
|
110
|
+
navigation?.sections?.map(section => (
|
|
111
|
+
<Fragment key={section?.id}>
|
|
112
|
+
<Box key="title-desc" padding="0">
|
|
113
|
+
<Stack>
|
|
114
|
+
<Box padding="0">
|
|
115
|
+
<Cluster justify="flex-start" align="center">
|
|
116
|
+
<Heading
|
|
117
|
+
variant="h4"
|
|
118
|
+
color={themeValues.darkText}
|
|
119
|
+
weight={FONT_WEIGHT_BOLD}
|
|
120
|
+
>
|
|
121
|
+
{section?.name}
|
|
122
|
+
</Heading>
|
|
123
|
+
<Box padding="0 8px" extraStyles={`margin-top: 8px;`}>
|
|
124
|
+
<IoIosArrowRoundForward
|
|
125
|
+
size="29px"
|
|
126
|
+
color={themeValues.darkText}
|
|
127
|
+
/>
|
|
128
|
+
</Box>
|
|
129
|
+
</Cluster>
|
|
130
|
+
</Box>
|
|
131
|
+
<Box padding="0">
|
|
132
|
+
<Paragraph>{section?.description}</Paragraph>
|
|
133
|
+
</Box>
|
|
134
|
+
</Stack>
|
|
135
|
+
</Box>
|
|
136
|
+
<Box key="linked-items" padding="0" minWidth="70%">
|
|
137
|
+
<Cluster justify="space-around" align="stretch">
|
|
138
|
+
{section?.linkLists?.map(linkList => (
|
|
139
|
+
<Box padding="0" extraStyles={`flex: 1;`}>
|
|
140
|
+
<Stack>
|
|
141
|
+
<Cluster justify="flex-start" align="center">
|
|
142
|
+
<Heading
|
|
143
|
+
variant="h4"
|
|
144
|
+
color={themeValues.darkText}
|
|
145
|
+
weight={FONT_WEIGHT_BOLD}
|
|
146
|
+
>
|
|
147
|
+
{linkList?.name}
|
|
148
|
+
</Heading>
|
|
149
|
+
<Box padding="0 8px" extraStyles={`margin-top: 8px;`}>
|
|
150
|
+
<IoIosArrowRoundForward
|
|
151
|
+
size="29px"
|
|
152
|
+
color={themeValues.darkText}
|
|
153
|
+
/>
|
|
154
|
+
</Box>
|
|
155
|
+
</Cluster>
|
|
156
|
+
<Box padding="24px 0">
|
|
157
|
+
<Stack>
|
|
158
|
+
{linkList?.links?.map(link => (
|
|
159
|
+
<Box padding="0">
|
|
160
|
+
<InternalLink to={link.externalUrl}>
|
|
161
|
+
<Paragraph color={themeValues.darkText}>
|
|
162
|
+
{link.text}
|
|
163
|
+
</Paragraph>
|
|
164
|
+
</InternalLink>
|
|
165
|
+
</Box>
|
|
166
|
+
))}
|
|
167
|
+
</Stack>
|
|
168
|
+
</Box>
|
|
169
|
+
</Stack>
|
|
170
|
+
</Box>
|
|
171
|
+
))}
|
|
172
|
+
<Box padding="0" key="featured-items" extraStyles={`flex: 1;`}>
|
|
173
|
+
<Stack>
|
|
174
|
+
<Heading
|
|
175
|
+
variant="h4"
|
|
176
|
+
weight={FONT_WEIGHT_BOLD}
|
|
177
|
+
color={themeValues.darkText}
|
|
178
|
+
>
|
|
179
|
+
Featured Items
|
|
180
|
+
</Heading>
|
|
181
|
+
{section?.featuredLinks?.links?.map(feat => (
|
|
182
|
+
<Box padding="0" minWidth="100%">
|
|
183
|
+
<Cluster justify="space-between" align="center">
|
|
184
|
+
<InternalLink to={feat.url}>
|
|
185
|
+
<Cluster justify="flex-start" align="center">
|
|
186
|
+
<Heading
|
|
187
|
+
variant="h6"
|
|
188
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
189
|
+
color={themeValues.darkText}
|
|
190
|
+
>
|
|
191
|
+
{feat.text}
|
|
192
|
+
</Heading>
|
|
193
|
+
<Box padding="0 8px" extraStyles={`margin-top: 8px;`}>
|
|
194
|
+
<IoIosArrowRoundForward
|
|
195
|
+
size="29px"
|
|
196
|
+
color={themeValues.darkText}
|
|
197
|
+
/>
|
|
198
|
+
</Box>
|
|
199
|
+
</Cluster>
|
|
200
|
+
</InternalLink>
|
|
201
|
+
</Cluster>
|
|
202
|
+
</Box>
|
|
203
|
+
))}
|
|
204
|
+
</Stack>
|
|
205
|
+
</Box>
|
|
206
|
+
</Cluster>
|
|
207
|
+
</Box>
|
|
208
|
+
</Fragment>
|
|
209
|
+
)) ?? [];
|
|
210
|
+
|
|
211
|
+
const menuWrapper = {
|
|
212
|
+
open: {
|
|
213
|
+
top: "0px",
|
|
214
|
+
transition: {
|
|
215
|
+
duration: 0.5
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
closed: {
|
|
219
|
+
top: "-500px",
|
|
220
|
+
transition: {
|
|
221
|
+
duration: 0.5
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
console.log("nav items are", navItems);
|
|
226
|
+
const menu = (
|
|
227
|
+
<Motion
|
|
228
|
+
padding="0"
|
|
229
|
+
variants={menuWrapper}
|
|
230
|
+
animate={navMenuOpen ? "open" : "closed"}
|
|
231
|
+
extraStyles={`position: absolute; z-index: 3;`}
|
|
232
|
+
positionTransition
|
|
233
|
+
minWidth="100%"
|
|
234
|
+
>
|
|
235
|
+
<Box
|
|
236
|
+
minWidth="100%"
|
|
237
|
+
background={themeValues.menuColor}
|
|
238
|
+
padding="0"
|
|
239
|
+
minHeight="29rem"
|
|
240
|
+
onMouseLeave={() => {
|
|
241
|
+
if (isAnimating === false) {
|
|
242
|
+
setNavMenuOpen(false);
|
|
243
|
+
}
|
|
244
|
+
}}
|
|
245
|
+
>
|
|
246
|
+
<Center maxWidth={isMobile ? "100%" : "76.5rem"} intrinsic={!isMobile}>
|
|
247
|
+
<Cluster justify="center" align="center" minWidth="100%">
|
|
248
|
+
<Box minHeight="29rem" padding="24px 0">
|
|
249
|
+
<Switcher breakpoint="45rem" largeChild="4" largeChildSize="2">
|
|
250
|
+
{navItems[selectedNavMenu]}
|
|
251
|
+
</Switcher>
|
|
252
|
+
</Box>
|
|
253
|
+
</Cluster>
|
|
254
|
+
</Center>
|
|
255
|
+
</Box>
|
|
256
|
+
</Motion>
|
|
257
|
+
);
|
|
258
|
+
console.log("navMenuOpen is....", navMenuOpen);
|
|
259
|
+
return (
|
|
260
|
+
<Box padding="0" role="banner">
|
|
261
|
+
<Helmet>
|
|
262
|
+
<title>{title.text}</title>
|
|
263
|
+
<link rel="shortcut icon" href={favicon} />
|
|
264
|
+
</Helmet>
|
|
265
|
+
<Box
|
|
266
|
+
padding="0"
|
|
267
|
+
extraStyles={`z-index: 25;`}
|
|
268
|
+
boxShadow={`0px 4px 2px 0px rgba(0, 0, 0, 0.19);`}
|
|
269
|
+
>
|
|
270
|
+
<NavHeader
|
|
271
|
+
backgroundColor={"#FFFFFF"}
|
|
272
|
+
leftContent={navLinksContainer}
|
|
273
|
+
isMobile={isMobile}
|
|
274
|
+
/>
|
|
275
|
+
</Box>
|
|
276
|
+
<Box padding="0" minWidth="100%">
|
|
277
|
+
{menu}
|
|
278
|
+
</Box>
|
|
279
|
+
</Box>
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export default withWindowSize(themeComponent(Header, "Header", fallbackValues));
|