@thecb/components 11.2.7-beta.1 → 11.2.8-beta.1
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 +11866 -12552
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14161 -14847
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/components/atoms/button-with-action/ButtonWithAction.js +25 -3
- package/src/components/atoms/layouts/Motion.js +6 -25
- package/src/components/atoms/layouts/Motion.styled.js +0 -36
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +15 -19
- package/src/components/molecules/hero-image/HeroImage.js +80 -51
- package/src/components/molecules/hero-image/HeroImage.stories.js +22 -1
- package/src/components/molecules/hero-image/HeroImage.styled.js +77 -24
- package/src/components/molecules/hero-image/HeroImage.theme.js +97 -3
- package/src/components/molecules/nav-menu/NavMenuMobile.js +12 -11
- package/src/deprecated/spinner/Spinner.js +20 -8
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/nav-footer/.DS_Store +0 -0
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/obligation/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecb/components",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.8-beta.1",
|
|
4
4
|
"description": "Common lib for CityBase react components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"@types/styled-components": "^5.1.34",
|
|
101
101
|
"core-js": "^3.22.5",
|
|
102
102
|
"formatted-input": "^1.0.0",
|
|
103
|
-
"framer-motion": "
|
|
103
|
+
"framer-motion": "^1.11.0",
|
|
104
104
|
"numeral": "^2.0.6",
|
|
105
105
|
"polished": "^4.0.3",
|
|
106
106
|
"ramda": "^0.27.0",
|
|
107
107
|
"react-aria-modal": "^4.0.0",
|
|
108
|
+
"react-pose": "^4.0.10",
|
|
108
109
|
"redux-freeform": "6.2.1"
|
|
109
|
-
}
|
|
110
|
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
110
|
+
}
|
|
111
111
|
}
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import React, { useContext, forwardRef } from "react";
|
|
2
2
|
import styled, { ThemeContext } from "styled-components";
|
|
3
|
+
import posed from "react-pose";
|
|
4
|
+
import { linear } from "@popmotion/easing";
|
|
3
5
|
import Text from "../text";
|
|
4
|
-
import { Box, Center
|
|
6
|
+
import { Box, Center } from "../layouts";
|
|
5
7
|
import { fallbackValues } from "./ButtonWithAction.theme";
|
|
6
8
|
|
|
7
9
|
import SpinnerIcon from "../../../deprecated/spinner";
|
|
8
10
|
import { noop } from "../../../util/general";
|
|
9
11
|
import { createThemeValues } from "../../../util/themeUtils";
|
|
10
12
|
|
|
11
|
-
const
|
|
13
|
+
const rotate = posed.div({
|
|
14
|
+
fixed: {
|
|
15
|
+
rotate: "0deg"
|
|
16
|
+
},
|
|
17
|
+
rotate: {
|
|
18
|
+
rotate: "360deg",
|
|
19
|
+
transition: {
|
|
20
|
+
rotate: {
|
|
21
|
+
ease: linear,
|
|
22
|
+
duration: 1000,
|
|
23
|
+
loop: Infinity
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const SpinnerContainer = styled.div`
|
|
12
30
|
width: 100%;
|
|
13
31
|
display: flex;
|
|
14
32
|
flex-direction: row;
|
|
@@ -16,9 +34,13 @@ const SpinnerContainer = styled(Motion)`
|
|
|
16
34
|
justify-content: center;
|
|
17
35
|
`;
|
|
18
36
|
|
|
37
|
+
const SpinnerIconWrapper = styled(rotate)``;
|
|
38
|
+
|
|
19
39
|
const Spinner = ({ color, isMobile }) => (
|
|
20
40
|
<SpinnerContainer>
|
|
21
|
-
<
|
|
41
|
+
<SpinnerIconWrapper initialPose="fixed" pose="rotate">
|
|
42
|
+
<SpinnerIcon color={color} isMobile={isMobile} />
|
|
43
|
+
</SpinnerIconWrapper>
|
|
22
44
|
</SpinnerContainer>
|
|
23
45
|
);
|
|
24
46
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Fragment, forwardRef } from "react";
|
|
2
|
-
import { MotionWrapper
|
|
2
|
+
import { MotionWrapper } from "./Motion.styled";
|
|
3
3
|
import { safeChildren } from "../../../util/general";
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -38,30 +38,11 @@ import { safeChildren } from "../../../util/general";
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
export const Motion = forwardRef(
|
|
41
|
-
(
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
useSpan = false,
|
|
47
|
-
...rest
|
|
48
|
-
},
|
|
49
|
-
ref
|
|
50
|
-
) =>
|
|
51
|
-
useSpan ? (
|
|
52
|
-
<MotionSpanWrapper
|
|
53
|
-
position={position}
|
|
54
|
-
padding={padding}
|
|
55
|
-
ref={ref}
|
|
56
|
-
{...rest}
|
|
57
|
-
>
|
|
58
|
-
{safeChildren(children, <Fragment />)}
|
|
59
|
-
</MotionSpanWrapper>
|
|
60
|
-
) : (
|
|
61
|
-
<MotionWrapper position={position} padding={padding} ref={ref} {...rest}>
|
|
62
|
-
{safeChildren(children, <Fragment />)}
|
|
63
|
-
</MotionWrapper>
|
|
64
|
-
)
|
|
41
|
+
({ position = "relative", padding = "0", children, ...rest }, ref) => (
|
|
42
|
+
<MotionWrapper position={position} padding={padding} ref={ref} {...rest}>
|
|
43
|
+
{safeChildren(children, <Fragment />)}
|
|
44
|
+
</MotionWrapper>
|
|
45
|
+
)
|
|
65
46
|
);
|
|
66
47
|
|
|
67
48
|
export default Motion;
|
|
@@ -36,39 +36,3 @@ export const MotionWrapper = styled(motion.div)`
|
|
|
36
36
|
|
|
37
37
|
${({ extraStyles }) => extraStyles};
|
|
38
38
|
`;
|
|
39
|
-
|
|
40
|
-
export const MotionSpanWrapper = styled(motion.span)`
|
|
41
|
-
position: ${({ position }) => position};
|
|
42
|
-
display: ${({ display }) => display};
|
|
43
|
-
box-sizing: border-box;
|
|
44
|
-
padding: ${({ padding }) => padding};
|
|
45
|
-
border: ${({ borderShorthand }) => borderShorthand};
|
|
46
|
-
border-color: ${({ borderColor }) => borderColor};
|
|
47
|
-
border-size: ${({ borderSize }) => borderSize};
|
|
48
|
-
border-style: ${({ borderStyle }) => borderStyle};
|
|
49
|
-
border-width: ${({ borderWidth }) => borderWidth};
|
|
50
|
-
border-radius: ${({ borderRadius }) => borderRadius};
|
|
51
|
-
background-color: ${({ backgroundColor }) => backgroundColor};
|
|
52
|
-
box-shadow: ${({ boxShadow }) => boxShadow};
|
|
53
|
-
min-height: ${({ minHeight }) => minHeight};
|
|
54
|
-
min-width: ${({ minWidth }) => minWidth};
|
|
55
|
-
height: ${({ height }) => height};
|
|
56
|
-
width: ${({ width }) => width};
|
|
57
|
-
text-align: ${({ textAlign }) => textAlign};
|
|
58
|
-
margin: ${({ margin }) => margin};
|
|
59
|
-
|
|
60
|
-
&:hover,
|
|
61
|
-
&:focus {
|
|
62
|
-
${({ hoverStyles }) => hoverStyles};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&:active {
|
|
66
|
-
${({ activeStyles }) => activeStyles};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&:disabled {
|
|
70
|
-
${({ disabledStyles }) => disabledStyles};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
${({ extraStyles }) => extraStyles};
|
|
74
|
-
`;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
+
import posed from "react-pose";
|
|
3
4
|
import { fallbackValues } from "./ToggleSwitch.theme";
|
|
4
5
|
import { themeComponent } from "../../../util/themeUtils";
|
|
5
|
-
import { Box, Center, Cover, Cluster
|
|
6
|
+
import { Box, Center, Cover, Cluster } from "../layouts";
|
|
6
7
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
7
8
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
8
9
|
import { ENTER } from "../../../constants/keyboard";
|
|
@@ -17,7 +18,7 @@ const HiddenToggleSwitchBox = styled.input`
|
|
|
17
18
|
width: ${({ isMobile }) => (isMobile ? `40px` : `44px`)};
|
|
18
19
|
`;
|
|
19
20
|
|
|
20
|
-
const VisibleSwitchComponent = styled
|
|
21
|
+
const VisibleSwitchComponent = styled.span`
|
|
21
22
|
width: ${({ isMobile }) => (isMobile ? `40px` : `44px`)};
|
|
22
23
|
height: ${({ isMobile }) => (isMobile ? `22px` : `24px`)};
|
|
23
24
|
border-radius: 12px;
|
|
@@ -37,7 +38,7 @@ const VisibleSwitchComponent = styled(Motion)`
|
|
|
37
38
|
}
|
|
38
39
|
`;
|
|
39
40
|
|
|
40
|
-
const ToggleSwitchRingComponent = styled
|
|
41
|
+
const ToggleSwitchRingComponent = styled.span`
|
|
41
42
|
position: absolute;
|
|
42
43
|
width: ${({ isMobile }) => (isMobile ? `14px` : `16px`)};
|
|
43
44
|
height: ${({ isMobile }) => (isMobile ? `14px` : `16px`)};
|
|
@@ -63,7 +64,7 @@ const ToggleSwitch = ({
|
|
|
63
64
|
extraStyles = ""
|
|
64
65
|
}) => {
|
|
65
66
|
const nameId = name.replace(/ /g, "-");
|
|
66
|
-
const
|
|
67
|
+
const ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
|
|
67
68
|
off: {
|
|
68
69
|
backgroundColor: disabled
|
|
69
70
|
? themeValues.disabledBackground
|
|
@@ -86,9 +87,12 @@ const ToggleSwitch = ({
|
|
|
86
87
|
ease: "backIn"
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
};
|
|
90
|
+
});
|
|
90
91
|
|
|
91
|
-
const
|
|
92
|
+
const VisibleSwitch = posed(VisibleSwitchComponent)({
|
|
93
|
+
focusable: true,
|
|
94
|
+
hoverable: true,
|
|
95
|
+
pressable: true,
|
|
92
96
|
focus: {
|
|
93
97
|
outline: "0px ridge rgba(170, 50, 220, 0)",
|
|
94
98
|
boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
|
|
@@ -120,7 +124,7 @@ const ToggleSwitch = ({
|
|
|
120
124
|
ease: "easeIn"
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
|
-
};
|
|
127
|
+
});
|
|
124
128
|
|
|
125
129
|
const handleKeyDown = e => {
|
|
126
130
|
if (e.keyCode === ENTER) {
|
|
@@ -164,25 +168,17 @@ const ToggleSwitch = ({
|
|
|
164
168
|
id={`#${nameId}`}
|
|
165
169
|
isMobile={isMobile}
|
|
166
170
|
/>
|
|
167
|
-
<
|
|
171
|
+
<VisibleSwitch
|
|
168
172
|
onClick={disabled ? noop : onToggle}
|
|
169
173
|
onKeyDown={disabled ? noop : handleKeyDown}
|
|
170
|
-
|
|
171
|
-
animate={isOn ? "on" : "off"}
|
|
172
|
-
variants={visibleSwitchVariants}
|
|
173
|
-
whileFocus="focus"
|
|
174
|
-
whileHover="hover"
|
|
174
|
+
pose={isOn ? "on" : "off"}
|
|
175
175
|
tabIndex={disabled ? -1 : 0}
|
|
176
176
|
disabled={disabled}
|
|
177
177
|
isMobile={isMobile}
|
|
178
|
-
useSpan
|
|
179
178
|
tabindex="0"
|
|
180
179
|
>
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
isMobile={isMobile}
|
|
184
|
-
/>
|
|
185
|
-
</VisibleSwitchComponent>
|
|
180
|
+
<ToggleSwitchRing isMobile={isMobile} />
|
|
181
|
+
</VisibleSwitch>
|
|
186
182
|
</Box>
|
|
187
183
|
</Cover>
|
|
188
184
|
{label && (
|
|
@@ -2,8 +2,6 @@ import React, { useContext } from "react";
|
|
|
2
2
|
import { ThemeContext } from "styled-components";
|
|
3
3
|
import { Box, Center, Stack } from "../../atoms/layouts";
|
|
4
4
|
import { themeComponent } from "../../../util/themeUtils";
|
|
5
|
-
import Paragraph from "../../atoms/paragraph";
|
|
6
|
-
import Title from "../../atoms/title";
|
|
7
5
|
import { fallbackValues } from "./HeroImage.theme";
|
|
8
6
|
import withWindowSize from "../../withWindowSize";
|
|
9
7
|
import {
|
|
@@ -27,80 +25,111 @@ const HeroImage = ({
|
|
|
27
25
|
secondaryHeadingVariant = "h2",
|
|
28
26
|
extraStyles
|
|
29
27
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
variant,
|
|
33
|
-
imageUrl,
|
|
34
|
-
isMobile,
|
|
35
|
-
heroPrimaryColor: themeValues.heroPrimaryColor
|
|
36
|
-
});
|
|
28
|
+
const themeContext = useContext(ThemeContext);
|
|
29
|
+
const { isMobile } = themeContext;
|
|
37
30
|
|
|
38
31
|
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
<Styled.HeroContainer
|
|
33
|
+
variant={variant}
|
|
34
|
+
minWidth={minWidth}
|
|
35
|
+
minHeight={minHeight}
|
|
36
|
+
padding={isMobile ? "2rem" : "3rem 2rem"}
|
|
37
|
+
extraStyles={extraStyles}
|
|
38
|
+
imageUrl={imageUrl}
|
|
39
|
+
isMobile={isMobile}
|
|
40
|
+
theme={themeValues}
|
|
41
|
+
>
|
|
42
|
+
<Center
|
|
43
|
+
maxWidth={contentMaxWidth}
|
|
44
|
+
width={"100%"}
|
|
45
|
+
intrinsic
|
|
46
|
+
extraStyles={`
|
|
47
|
+
flex-flow: unset;
|
|
48
|
+
justify-content: ${Styled.getDeviceStyles(
|
|
49
|
+
isMobile,
|
|
50
|
+
themeValues.justifyContent
|
|
51
|
+
)};
|
|
52
|
+
flex-wrap: nowrap;
|
|
53
|
+
`}
|
|
45
54
|
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
flex-flow: unset;
|
|
52
|
-
justify-content: flex-start;
|
|
53
|
-
flex-wrap: nowrap;
|
|
54
|
-
`}
|
|
55
|
+
<Stack
|
|
56
|
+
childGap={contentSpacing}
|
|
57
|
+
extraStyles={`max-width: ${
|
|
58
|
+
isMobile || variant === "v2" ? "100%" : "50%"
|
|
59
|
+
};`}
|
|
55
60
|
>
|
|
56
|
-
|
|
57
|
-
childGap={contentSpacing}
|
|
58
|
-
extraStyles={`max-width: ${isMobile ? "100%" : "50%"};`}
|
|
59
|
-
>
|
|
61
|
+
{variant === "v1" ? (
|
|
60
62
|
<Stack childGap="0">
|
|
61
63
|
{heading && (
|
|
62
|
-
<
|
|
64
|
+
<Styled.HeroHeading
|
|
63
65
|
variant="hero"
|
|
64
66
|
as={headingVariant}
|
|
65
67
|
weight={FONT_WEIGHT_BOLD}
|
|
66
68
|
color={themeValues.heroTextColor}
|
|
67
|
-
|
|
69
|
+
textAlign={Styled.getDeviceStyles(
|
|
70
|
+
isMobile,
|
|
71
|
+
themeValues.textAlign
|
|
72
|
+
)}
|
|
73
|
+
isMobile={isMobile}
|
|
74
|
+
theme={themeValues}
|
|
68
75
|
>
|
|
69
76
|
{heading}
|
|
70
|
-
</
|
|
77
|
+
</Styled.HeroHeading>
|
|
71
78
|
)}
|
|
72
79
|
{subheading && (
|
|
73
|
-
<
|
|
74
|
-
variant=
|
|
80
|
+
<Styled.HeroSubheading
|
|
81
|
+
variant="large"
|
|
75
82
|
as={secondaryHeadingVariant}
|
|
76
83
|
weight={FONT_WEIGHT_SEMIBOLD}
|
|
77
|
-
|
|
84
|
+
textAlign={Styled.getDeviceStyles(
|
|
85
|
+
isMobile,
|
|
86
|
+
themeValues.textAlign
|
|
87
|
+
)}
|
|
78
88
|
color={themeValues.heroTextColor}
|
|
79
|
-
|
|
89
|
+
isMobile={isMobile}
|
|
90
|
+
theme={themeValues}
|
|
80
91
|
>
|
|
81
92
|
{subheading}
|
|
82
|
-
</
|
|
93
|
+
</Styled.HeroSubheading>
|
|
83
94
|
)}
|
|
84
95
|
</Stack>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
) : (
|
|
97
|
+
<>
|
|
98
|
+
{heading && (
|
|
99
|
+
<Styled.HeroHeading
|
|
100
|
+
variant="hero"
|
|
101
|
+
as={headingVariant}
|
|
102
|
+
weight={FONT_WEIGHT_BOLD}
|
|
88
103
|
color={themeValues.heroTextColor}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
textAlign={Styled.getDeviceStyles(
|
|
105
|
+
isMobile,
|
|
106
|
+
themeValues.textAlign
|
|
107
|
+
)}
|
|
108
|
+
isMobile={isMobile}
|
|
109
|
+
theme={themeValues}
|
|
92
110
|
>
|
|
93
|
-
{
|
|
94
|
-
</
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
{heading}
|
|
112
|
+
</Styled.HeroHeading>
|
|
113
|
+
)}
|
|
114
|
+
</>
|
|
115
|
+
)}
|
|
116
|
+
{description && (
|
|
117
|
+
<Box padding="0">
|
|
118
|
+
<Styled.HeroDescription
|
|
119
|
+
color={themeValues.heroTextColor}
|
|
120
|
+
isMobile={isMobile}
|
|
121
|
+
theme={themeValues}
|
|
122
|
+
>
|
|
123
|
+
{description}
|
|
124
|
+
</Styled.HeroDescription>
|
|
125
|
+
</Box>
|
|
126
|
+
)}
|
|
127
|
+
</Stack>
|
|
128
|
+
</Center>
|
|
129
|
+
</Styled.HeroContainer>
|
|
101
130
|
);
|
|
102
131
|
};
|
|
103
132
|
|
|
104
133
|
export default withWindowSize(
|
|
105
|
-
themeComponent(HeroImage, "HeroImage", fallbackValues)
|
|
134
|
+
themeComponent(HeroImage, "HeroImage", fallbackValues, "v1")
|
|
106
135
|
);
|
|
@@ -118,7 +118,7 @@ export const DesktopV1 = {
|
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
export const
|
|
121
|
+
export const NoImageV1 = {
|
|
122
122
|
args: {
|
|
123
123
|
variant: "v1",
|
|
124
124
|
minWidth: "1000px",
|
|
@@ -126,3 +126,24 @@ export const NoImage = {
|
|
|
126
126
|
imageUrl: undefined
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
+
|
|
130
|
+
export const DesktopV2 = {
|
|
131
|
+
args: {
|
|
132
|
+
heading: "Cityville Payment Center",
|
|
133
|
+
variant: "v2",
|
|
134
|
+
minWidth: "1000px",
|
|
135
|
+
minHeight: "274px",
|
|
136
|
+
imageUrl:
|
|
137
|
+
"https://cb-public-assets.s3-us-west-2.amazonaws.com/cityville/hero.jpg"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const NoImageV2 = {
|
|
142
|
+
args: {
|
|
143
|
+
heading: "Cityville Payment Center",
|
|
144
|
+
variant: "v2",
|
|
145
|
+
minWidth: "1000px",
|
|
146
|
+
minHeight: "274px",
|
|
147
|
+
imageUrl: undefined
|
|
148
|
+
}
|
|
149
|
+
};
|
|
@@ -1,30 +1,83 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
import { Box } from "../../atoms";
|
|
3
|
-
import
|
|
3
|
+
import { Paragraph, Box } from "../../atoms";
|
|
4
|
+
import Title from "../../atoms/title/Title.js";
|
|
5
|
+
import { rgba, adjustHue, darken } from "polished";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
const getHeroGradientStyles = ({ variant, isMobile, heroPrimaryColor }) => {
|
|
8
|
+
const v1Gradient = `linear-gradient(
|
|
9
|
+
90deg,
|
|
10
|
+
${heroPrimaryColor} 33%,
|
|
11
|
+
transparent 100%
|
|
12
|
+
)`;
|
|
13
|
+
const v1GradientMobile = `linear-gradient(
|
|
14
|
+
${rgba(heroPrimaryColor, 0.8)},
|
|
15
|
+
${rgba(heroPrimaryColor, 0.8)}
|
|
16
|
+
)`;
|
|
17
|
+
const heroSecondaryColor = darken(0.18, adjustHue(-29, heroPrimaryColor));
|
|
18
|
+
const v2Gradient = `linear-gradient(
|
|
19
|
+
90deg,
|
|
20
|
+
${rgba(heroPrimaryColor, 0.8)} 0%,
|
|
21
|
+
${rgba(heroSecondaryColor, 0.8)} 100%
|
|
22
|
+
)`;
|
|
23
|
+
|
|
24
|
+
return variant === "v1"
|
|
25
|
+
? isMobile
|
|
26
|
+
? v1GradientMobile
|
|
27
|
+
: v1Gradient
|
|
28
|
+
: v2Gradient;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
export const
|
|
31
|
+
export const getDeviceStyles = (isMobile, theme) =>
|
|
32
|
+
isMobile ? theme.mobile : theme.desktop;
|
|
33
|
+
|
|
34
|
+
export const HeroContainer = styled(
|
|
35
|
+
({ variant, imageUrl, isMobile, theme, extraStyles, ...props }) => (
|
|
36
|
+
<Box {...props} />
|
|
37
|
+
)
|
|
38
|
+
)`
|
|
29
39
|
display: flex;
|
|
40
|
+
background: ${({ variant, imageUrl, isMobile, theme }) =>
|
|
41
|
+
`${getHeroGradientStyles({
|
|
42
|
+
variant,
|
|
43
|
+
isMobile,
|
|
44
|
+
heroPrimaryColor: theme.heroPrimaryColor
|
|
45
|
+
})},
|
|
46
|
+
url(${imageUrl}) center / cover no-repeat, ${theme.heroPrimaryColor}`};
|
|
47
|
+
${({ extraStyles }) => extraStyles}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export const HeroHeading = styled(({ theme, isMobile, ...props }) => (
|
|
51
|
+
<Title {...props} />
|
|
52
|
+
))`
|
|
53
|
+
font-size: ${({ theme, isMobile }) =>
|
|
54
|
+
getDeviceStyles(isMobile, theme.headingFontSize)};
|
|
55
|
+
color: ${({ color }) => color};
|
|
56
|
+
font-weight: ${({ weight }) => weight};
|
|
57
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
58
|
+
line-height: ${({ theme, isMobile }) =>
|
|
59
|
+
getDeviceStyles(isMobile, theme.headingLineHeight)};
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const HeroSubheading = styled(({ theme, isMobile, ...props }) => (
|
|
63
|
+
<Title {...props} />
|
|
64
|
+
))`
|
|
65
|
+
font-size: ${({ theme, isMobile }) =>
|
|
66
|
+
getDeviceStyles(isMobile, theme.subheadingFontSize)};
|
|
67
|
+
color: ${({ color }) => color};
|
|
68
|
+
font-weight: ${({ weight }) => weight};
|
|
69
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
70
|
+
line-height: ${({ theme, isMobile }) =>
|
|
71
|
+
getDeviceStyles(isMobile, theme.subheadingLineHeight)};
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
export const HeroDescription = styled(({ theme, isMobile, ...props }) => (
|
|
75
|
+
<Paragraph {...props} />
|
|
76
|
+
))`
|
|
77
|
+
line-height: ${({ theme, isMobile }) =>
|
|
78
|
+
getDeviceStyles(isMobile, theme.descriptionLineHeight)};
|
|
79
|
+
font-size: ${({ theme, isMobile }) =>
|
|
80
|
+
getDeviceStyles(isMobile, theme.descriptionFontSize)};
|
|
81
|
+
text-align: ${({ theme, isMobile }) =>
|
|
82
|
+
getDeviceStyles(isMobile, theme.textAlign)};
|
|
30
83
|
`;
|
|
@@ -3,13 +3,107 @@ import {
|
|
|
3
3
|
ROYAL_BLUE_VIVID,
|
|
4
4
|
WHITE
|
|
5
5
|
} from "../../../constants/colors";
|
|
6
|
+
import { FONT_SIZE } from "../../../constants/style_constants";
|
|
6
7
|
|
|
8
|
+
// Colors
|
|
7
9
|
const heroPrimaryColor = ROYAL_BLUE_VIVID;
|
|
8
|
-
const heroSecondaryColor = MATISSE_BLUE;
|
|
9
10
|
const heroTextColor = WHITE;
|
|
10
11
|
|
|
12
|
+
// Font Sizes
|
|
13
|
+
const headingFontSize = {
|
|
14
|
+
v1: {
|
|
15
|
+
mobile: "3.00rem",
|
|
16
|
+
desktop: "3.50rem"
|
|
17
|
+
},
|
|
18
|
+
v2: {
|
|
19
|
+
mobile: "2.50rem",
|
|
20
|
+
desktop: "3.50rem"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const subheadingFontSize = {
|
|
24
|
+
v1: {
|
|
25
|
+
mobile: "2.00rem",
|
|
26
|
+
desktop: "2.50rem"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const descriptionFontSize = {
|
|
31
|
+
v1: {
|
|
32
|
+
mobile: FONT_SIZE.MD,
|
|
33
|
+
desktop: FONT_SIZE.XL
|
|
34
|
+
},
|
|
35
|
+
v2: {
|
|
36
|
+
mobile: FONT_SIZE.LG,
|
|
37
|
+
desktop: FONT_SIZE.XL
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Line Heights
|
|
42
|
+
const headingLineHeight = {
|
|
43
|
+
v1: {
|
|
44
|
+
mobile: 1.25,
|
|
45
|
+
desktop: 1.15
|
|
46
|
+
},
|
|
47
|
+
v2: {
|
|
48
|
+
mobile: 1.25,
|
|
49
|
+
desktop: 1.15
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const subheadingLineHeight = {
|
|
54
|
+
v1: {
|
|
55
|
+
mobile: 1.5,
|
|
56
|
+
desktop: 1.15
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const descriptionLineHeight = {
|
|
61
|
+
v1: {
|
|
62
|
+
mobile: 1.5,
|
|
63
|
+
desktop: 1.5
|
|
64
|
+
},
|
|
65
|
+
v2: {
|
|
66
|
+
mobile: 1.5,
|
|
67
|
+
desktop: 1.5
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Alignment
|
|
72
|
+
const textAlign = {
|
|
73
|
+
v1: {
|
|
74
|
+
mobile: "left",
|
|
75
|
+
desktop: "left"
|
|
76
|
+
},
|
|
77
|
+
v2: {
|
|
78
|
+
mobile: "left",
|
|
79
|
+
desktop: "center"
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const justifyContent = {
|
|
84
|
+
v1: {
|
|
85
|
+
mobile: "flex-start",
|
|
86
|
+
desktop: "flex-start"
|
|
87
|
+
},
|
|
88
|
+
v2: {
|
|
89
|
+
mobile: "flex-start",
|
|
90
|
+
desktop: "center"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
11
94
|
export const fallbackValues = {
|
|
95
|
+
// Colors
|
|
12
96
|
heroPrimaryColor,
|
|
13
|
-
|
|
14
|
-
|
|
97
|
+
heroTextColor,
|
|
98
|
+
// Font sizes
|
|
99
|
+
headingFontSize,
|
|
100
|
+
descriptionFontSize,
|
|
101
|
+
subheadingFontSize,
|
|
102
|
+
// Line heights
|
|
103
|
+
headingLineHeight,
|
|
104
|
+
subheadingLineHeight,
|
|
105
|
+
descriptionLineHeight,
|
|
106
|
+
// Alignment
|
|
107
|
+
textAlign,
|
|
108
|
+
justifyContent
|
|
15
109
|
};
|