@thecb/components 11.2.6 → 11.2.8-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 +49 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +49 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/hero-image/HeroImage.js +58 -37
- package/src/components/molecules/hero-image/HeroImage.stories.js +22 -1
- package/src/components/molecules/hero-image/HeroImage.styled.js +32 -21
package/package.json
CHANGED
|
@@ -2,7 +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
5
|
import Title from "../../atoms/title";
|
|
7
6
|
import { fallbackValues } from "./HeroImage.theme";
|
|
8
7
|
import withWindowSize from "../../withWindowSize";
|
|
@@ -28,35 +27,42 @@ const HeroImage = ({
|
|
|
28
27
|
extraStyles
|
|
29
28
|
}) => {
|
|
30
29
|
const { isMobile } = useContext(ThemeContext);
|
|
31
|
-
const
|
|
30
|
+
const gradientStyles = Styled.getHeroGradientStyles({
|
|
32
31
|
variant,
|
|
33
|
-
imageUrl,
|
|
34
32
|
isMobile,
|
|
35
|
-
heroPrimaryColor: themeValues.heroPrimaryColor
|
|
33
|
+
heroPrimaryColor: themeValues.heroPrimaryColor,
|
|
34
|
+
heroSecondaryColor: themeValues.heroSecondaryColor
|
|
36
35
|
});
|
|
37
36
|
|
|
38
37
|
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
<Box
|
|
39
|
+
minWidth={minWidth}
|
|
40
|
+
minHeight={minHeight}
|
|
41
|
+
padding={isMobile ? "2rem" : "3rem 2rem"}
|
|
42
|
+
extraStyles={`
|
|
43
|
+
display: flex;
|
|
44
|
+
background: ${gradientStyles},
|
|
45
|
+
url(${imageUrl}) center / cover no-repeat, ${themeValues.heroPrimaryColor};
|
|
46
|
+
${extraStyles}
|
|
47
|
+
`}
|
|
48
|
+
>
|
|
49
|
+
<Center
|
|
50
|
+
maxWidth={contentMaxWidth}
|
|
51
|
+
width={"100%"}
|
|
52
|
+
intrinsic
|
|
53
|
+
extraStyles={`
|
|
54
|
+
flex-flow: unset;
|
|
55
|
+
justify-content: ${variant === "v2" ? "center" : "flex-start"};
|
|
56
|
+
flex-wrap: nowrap;
|
|
57
|
+
`}
|
|
45
58
|
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
flex-flow: unset;
|
|
52
|
-
justify-content: flex-start;
|
|
53
|
-
flex-wrap: nowrap;
|
|
54
|
-
`}
|
|
59
|
+
<Stack
|
|
60
|
+
childGap={contentSpacing}
|
|
61
|
+
extraStyles={`max-width: ${
|
|
62
|
+
isMobile || variant === "v2" ? "100%" : "50%"
|
|
63
|
+
};`}
|
|
55
64
|
>
|
|
56
|
-
|
|
57
|
-
childGap={contentSpacing}
|
|
58
|
-
extraStyles={`max-width: ${isMobile ? "100%" : "50%"};`}
|
|
59
|
-
>
|
|
65
|
+
{variant === "v1" ? (
|
|
60
66
|
<Stack childGap="0">
|
|
61
67
|
{heading && (
|
|
62
68
|
<Title
|
|
@@ -82,22 +88,37 @@ const HeroImage = ({
|
|
|
82
88
|
</Title>
|
|
83
89
|
)}
|
|
84
90
|
</Stack>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
) : (
|
|
92
|
+
<>
|
|
93
|
+
{heading && (
|
|
94
|
+
<Title
|
|
95
|
+
variant="hero"
|
|
96
|
+
as={headingVariant}
|
|
97
|
+
weight={FONT_WEIGHT_BOLD}
|
|
88
98
|
color={themeValues.heroTextColor}
|
|
89
|
-
extraStyles={`line-height:
|
|
90
|
-
|
|
91
|
-
}
|
|
99
|
+
extraStyles={`text-align: center; line-height: ${
|
|
100
|
+
isMobile ? "125%" : "115%"
|
|
101
|
+
};`}
|
|
92
102
|
>
|
|
93
|
-
{
|
|
94
|
-
</
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
{heading}
|
|
104
|
+
</Title>
|
|
105
|
+
)}
|
|
106
|
+
</>
|
|
107
|
+
)}
|
|
108
|
+
{description && (
|
|
109
|
+
<Box padding="0">
|
|
110
|
+
<Styled.HeroDescription
|
|
111
|
+
color={themeValues.heroTextColor}
|
|
112
|
+
isMobile={isMobile}
|
|
113
|
+
variant={variant}
|
|
114
|
+
>
|
|
115
|
+
{description}
|
|
116
|
+
</Styled.HeroDescription>
|
|
117
|
+
</Box>
|
|
118
|
+
)}
|
|
119
|
+
</Stack>
|
|
120
|
+
</Center>
|
|
121
|
+
</Box>
|
|
101
122
|
);
|
|
102
123
|
};
|
|
103
124
|
|
|
@@ -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,41 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
import {
|
|
3
|
+
import { Paragraph } from "../../atoms";
|
|
3
4
|
import { rgba } from "polished";
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
+
export const getHeroGradientStyles = ({
|
|
6
7
|
variant,
|
|
7
|
-
imageUrl,
|
|
8
8
|
isMobile,
|
|
9
|
-
heroPrimaryColor
|
|
9
|
+
heroPrimaryColor,
|
|
10
|
+
heroSecondaryColor
|
|
10
11
|
}) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
const v1Gradient = `linear-gradient(
|
|
13
|
+
90deg,
|
|
14
|
+
${heroPrimaryColor} 33%,
|
|
15
|
+
transparent 100%
|
|
16
|
+
)`;
|
|
17
|
+
const v1GradientMobile = `linear-gradient(
|
|
18
|
+
${rgba(heroPrimaryColor, 0.8)},
|
|
19
|
+
${rgba(heroPrimaryColor, 0.8)}
|
|
20
|
+
)`;
|
|
21
|
+
const v2Gradient = `linear-gradient(
|
|
22
|
+
90deg,
|
|
23
|
+
${rgba(heroPrimaryColor, 0.8)} 0%,
|
|
24
|
+
${rgba(heroSecondaryColor, 0.8)} 100%
|
|
25
|
+
)`;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
v1: isMobile ? v1GradientMobile : v1Gradient,
|
|
29
|
+
v2: v2Gradient
|
|
30
|
+
}[variant];
|
|
26
31
|
};
|
|
27
32
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
33
|
+
export const HeroDescription = styled(({ variant, isMobile, ...props }) => (
|
|
34
|
+
<Paragraph {...props} />
|
|
35
|
+
))`
|
|
36
|
+
line-height: 150%;
|
|
37
|
+
font-size: ${({ isMobile }) => (!isMobile ? "1.25rem" : "inherit")};
|
|
38
|
+
text-align: ${({ variant }) => (variant === "v2" ? "center" : "inherit")};
|
|
39
|
+
font-size: ${({ variant, isMobile }) =>
|
|
40
|
+
variant === "v2" ? (isMobile ? "1.125rem" : "1.25rem") : "inherit"};
|
|
30
41
|
`;
|