@thecb/components 11.2.5-beta.2 → 11.2.6-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.2.5-beta.2",
3
+ "version": "11.2.6-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,16 +1,19 @@
1
1
  // Comments assume desktop base font size of 16px, mobile base font size of 14px
2
2
 
3
3
  const fontSize = {
4
+ hero: "3rem", // 48px
4
5
  large: "1.5rem", // 24px (at base font size of 16px)
5
6
  small: "1.25rem" // 20px
6
7
  };
7
8
 
8
9
  const fontFamily = {
10
+ hero: "Public Sans",
9
11
  large: "Public Sans",
10
12
  small: "Public Sans"
11
13
  };
12
14
 
13
15
  const mobileFontSize = {
16
+ hero: "2.5rem", // 40px
14
17
  large: "1.5rem", // 21px (at base font size of 14px)
15
18
  small: "1.2142rem" // 17px
16
19
  };
@@ -0,0 +1,84 @@
1
+ import React, { useContext } from "react";
2
+ import { ThemeContext } from "styled-components";
3
+ import { Box, Cluster, Stack } from "../../atoms/layouts";
4
+ import BoxWithShadow from "../../atoms/box-with-shadow";
5
+ import { themeComponent } from "../../../util/themeUtils";
6
+ import Paragraph from "../../atoms/paragraph";
7
+ import Title from "../../atoms/title";
8
+ import { fallbackValues } from "./HeroImage.theme";
9
+ import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
10
+ import * as Styled from "./HeroImage.styled";
11
+
12
+ const HeroImage = ({
13
+ themeValues,
14
+ heading,
15
+ subheading,
16
+ description,
17
+ imageUrl,
18
+ variant = "v1",
19
+ padding = "4rem",
20
+ minWidth = "100%",
21
+ minHeight = "auto",
22
+ contentSpacing = "0.5rem"
23
+ }) => {
24
+ const { isMobile } = useContext(ThemeContext);
25
+
26
+ return (
27
+ <>
28
+ {imageUrl && (
29
+ <Styled.HeroImageContainer
30
+ minWidth={minWidth}
31
+ minHeight={minHeight}
32
+ padding={padding}
33
+ extraStyles={Styled.getHeroImageVariantStyles({
34
+ imageUrl,
35
+ variant,
36
+ gradientPrimary: themeValues.gradientColorPrimary,
37
+ gradientSecondary: themeValues.gradientColorSecondary
38
+ })}
39
+ >
40
+ <Box
41
+ padding="0"
42
+ maxWidth={isMobile ? "100%" : "50%"}
43
+ extraStyles={"display: flex; align-items: center;"}
44
+ >
45
+ <Stack childGap={contentSpacing}>
46
+ <Stack childGap="0">
47
+ <Title
48
+ variant="hero"
49
+ as="h2"
50
+ weight={FONT_WEIGHT_SEMIBOLD}
51
+ color={themeValues.textColor}
52
+ extraStyles={`line-height: 115%;`}
53
+ >
54
+ {heading}
55
+ </Title>
56
+ <Title
57
+ variant={"large"}
58
+ as="h3"
59
+ weight={FONT_WEIGHT_SEMIBOLD}
60
+ fontSize={!isMobile && "2rem"}
61
+ color={themeValues.textColor}
62
+ extraStyles={`line-height: 115%;`}
63
+ >
64
+ {subheading}
65
+ </Title>
66
+ </Stack>
67
+ <Box padding="0">
68
+ <Paragraph
69
+ color={themeValues.textColor}
70
+ extraStyles={`line-height: 150%; ${!isMobile &&
71
+ `font-size: 1.125rem;`}`}
72
+ >
73
+ {description}
74
+ </Paragraph>
75
+ </Box>
76
+ </Stack>
77
+ </Box>
78
+ </Styled.HeroImageContainer>
79
+ )}
80
+ </>
81
+ );
82
+ };
83
+
84
+ export default themeComponent(HeroImage, "HeroImage", fallbackValues);
@@ -0,0 +1,15 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as HeroImageStories from './HeroImage.stories.js';
4
+
5
+ <Meta of={HeroImageStories} />
6
+
7
+ <Title />
8
+
9
+ HeroImage is a themeable component that renders a heading, sub-heading, and description with an image gradient background. It supports custom padding and content spacing for both mobile and desktop, as well as minimum width and height values.
10
+
11
+ <div style={{ margin: "2em 0"}}>
12
+ <Story />
13
+ </div>
14
+
15
+ <Controls />
@@ -0,0 +1,91 @@
1
+ import { variants } from "styled-theming";
2
+ import HeroImage from "./HeroImage";
3
+
4
+ const meta = {
5
+ title: "Molecules/HeroImage",
6
+ component: HeroImage,
7
+ parameters: {
8
+ layout: "centered"
9
+ },
10
+ tags: ["!autodocs"],
11
+ args: {
12
+ heading: "Cityville",
13
+ subheading: "Payment Center",
14
+ description:
15
+ "Find and make payments quickly and conveniently from your computer or phone.",
16
+ imageUrl:
17
+ "https://thecitybase.wpenginepowered.com/wp-content/uploads/2020/02/homepage-hero2.jpg",
18
+ contentSpacing: "0.5rem"
19
+ },
20
+ argTypes: {
21
+ heading: {
22
+ description: "Hero image main heading",
23
+ table: {
24
+ type: { summary: "string" },
25
+ defaultValue: { summary: undefined }
26
+ }
27
+ },
28
+ subheading: {
29
+ description: "Hero image sub-heading",
30
+ table: {
31
+ type: { summary: "string" },
32
+ defaultValue: { summary: undefined }
33
+ }
34
+ },
35
+ description: {
36
+ description: "Hero image description",
37
+ table: {
38
+ type: { summary: "string" },
39
+ defaultValue: { summary: undefined }
40
+ }
41
+ },
42
+ imageUrl: {
43
+ description: "Image URL for the hero image",
44
+ table: {
45
+ type: { summary: "string" },
46
+ defaultValue: { summary: undefined }
47
+ }
48
+ },
49
+ padding: {
50
+ description: "Padding around the HeroImage content (desktop)",
51
+ table: {
52
+ type: { summary: "string" },
53
+ defaultValue: { summary: "0.5rem 1.5rem" }
54
+ }
55
+ },
56
+ minWidth: {
57
+ description:
58
+ "Minimum width of the HeroImage, must be a valid value for the `min-width` property.",
59
+ table: {
60
+ type: { summary: "string" },
61
+ defaultValue: { summary: "100%" }
62
+ }
63
+ },
64
+ minHeight: {
65
+ description:
66
+ "Minimum height of the HeroImage, must be a valid value for the `min-height` property.",
67
+ table: {
68
+ type: { summary: "string" },
69
+ defaultValue: { summary: "auto" }
70
+ }
71
+ },
72
+ contentSpacing: {
73
+ description:
74
+ "Space between the headers and image, must be a valid CSS measurement value with a unit",
75
+ table: {
76
+ type: { summary: "string" },
77
+ defaultValue: { summary: "3rem" }
78
+ }
79
+ }
80
+ }
81
+ };
82
+
83
+ export default meta;
84
+
85
+ export const DesktopV1 = {
86
+ args: {
87
+ variant: "v1",
88
+ minWidth: "1000px",
89
+ minHeight: "274px"
90
+ }
91
+ };
@@ -0,0 +1,21 @@
1
+ import styled, { css } from "styled-components";
2
+ import { Box } from "../../atoms";
3
+
4
+ export const getHeroImageVariantStyles = ({
5
+ imageUrl,
6
+ variant,
7
+ gradientPrimary,
8
+ gradientSecondary
9
+ }) => `
10
+ background: linear-gradient(
11
+ 90deg,
12
+ ${gradientPrimary} 33%,
13
+ rgba(59, 91, 219, 0) 100%
14
+ ),
15
+ url(${imageUrl});
16
+ background-size: cover;
17
+ `;
18
+
19
+ export const HeroImageContainer = styled(Box)`
20
+ display: flex;
21
+ `;
@@ -0,0 +1,15 @@
1
+ import {
2
+ MATISSE_BLUE,
3
+ ROYAL_BLUE_VIVID,
4
+ WHITE
5
+ } from "../../../constants/colors";
6
+
7
+ const gradientColorPrimary = ROYAL_BLUE_VIVID;
8
+ const gradientColorSecondary = MATISSE_BLUE;
9
+ const textColor = WHITE;
10
+
11
+ export const fallbackValues = {
12
+ gradientColorPrimary,
13
+ gradientColorSecondary,
14
+ textColor
15
+ };
@@ -0,0 +1,3 @@
1
+ import HeroImage from "./HeroImage";
2
+
3
+ export default HeroImage;
@@ -45,3 +45,4 @@ export { default as WorkflowTile } from "./workflow-tile";
45
45
  export { default as PopupMenu } from "./popup-menu";
46
46
  export { default as MultipleSelectFilter } from "./multiple-select-filter";
47
47
  export { default as ContactCard } from "./contact-card";
48
+ export { default as HeroImage } from "./hero-image";
@@ -37,7 +37,6 @@ const RegistrationBanner = ({
37
37
  justify="space-between"
38
38
  overflow="visible"
39
39
  isMobile={isMobile}
40
- nowrap
41
40
  >
42
41
  <Box padding="0" textAlign="left">
43
42
  <Heading
@@ -47,18 +46,18 @@ const RegistrationBanner = ({
47
46
  variant={titleVariant}
48
47
  weight={FONT_WEIGHT_SEMIBOLD}
49
48
  >
50
- Register for a {clientName} Wallet
49
+ Register for a {clientName} Wallet Account
51
50
  </Heading>
52
51
  <Text
53
52
  extraStyles={`
54
53
  display: block;
55
54
  padding: ${isMobile ? ".125rem 0 1rem" : "0"}
56
55
  `}
57
- fontSize={isMobile ? FONT_SIZE.MD : FONT_SIZE.LG}
56
+ fontSize={isMobile ? FONT_SIZE.SM : FONT_SIZE.LG}
58
57
  color={themeValues.secondaryColor}
59
58
  >
60
- Save payment methods and billing information for fast, easy, and
61
- safe payments with {clientName}
59
+ Save payment methods and information for fast, easy, and safe
60
+ payments with {clientName}
62
61
  </Text>
63
62
  </Box>
64
63
  <Styled.ButtonContainer
@@ -74,11 +73,7 @@ const RegistrationBanner = ({
74
73
  fontWeight={FONT_WEIGHT_SEMIBOLD}
75
74
  url={registrationLink}
76
75
  >
77
- <Cluster
78
- justify="center"
79
- align="center"
80
- extraStyles="min-width: 100%"
81
- >
76
+ <Cluster justify="center" align="center">
82
77
  <Text
83
78
  extraStyles="margin-right: 0.5rem"
84
79
  fontSize={isMobile ? FONT_SIZE.MD : FONT_SIZE.LG}
@@ -6,12 +6,12 @@ import { adjustHexColor } from "../../../util/general";
6
6
  export const BannerContainer = styled(Cluster)`
7
7
  background: ${({ themeValues }) =>
8
8
  adjustHexColor(themeValues.background, 10, "lighten")};
9
- padding: 2rem;
9
+ padding: ${({ isMobile }) => (isMobile ? "1rem 2rem" : " 2rem 8.25rem")};
10
10
  `;
11
11
 
12
12
  export const ContentContainer = styled(Cluster)`
13
13
  padding: 0;
14
- width: ${({ isMobile }) => (isMobile ? "100%" : " 1224px")};
14
+ width: ${({ isMobile }) => (isMobile ? "296px" : " 1176px")};
15
15
  > div {
16
16
  flex-direction: ${({ isMobile }) => (isMobile ? "column" : "row")};
17
17
  }
@@ -19,10 +19,8 @@ export const ContentContainer = styled(Cluster)`
19
19
 
20
20
  export const ButtonContainer = styled(Stack)`
21
21
  align-items: center;
22
- width: ${({ isMobile }) => (isMobile ? "100%" : "222px")};
23
- padding-left: ${({ isMobile }) => (isMobile ? "0" : "2rem")};
24
- > * {
25
- width: inherit;
22
+ > a {
23
+ width: ${({ isMobile }) => (isMobile ? "296px" : "222px")};
26
24
  }
27
25
  `;
28
26
 
Binary file