@thecb/components 10.7.1-beta.0 → 10.7.1-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.7.1-beta.0",
3
+ "version": "10.7.1-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",
@@ -7,7 +7,6 @@ import { ThemeContext } from "styled-components";
7
7
  import Module from "../../molecules/module/Module";
8
8
  import Spinner from "../spinner/Spinner";
9
9
  import { CHARADE_GREY } from "../../../constants/colors";
10
- import { noop } from "../../../util/general";
11
10
 
12
11
  const WalletName = ({
13
12
  mainText, // left side text
@@ -16,7 +15,9 @@ const WalletName = ({
16
15
  actionText = null, // right side hyperlinked text
17
16
  disableAction = false,
18
17
  linkButtonExtraStyles = "", // hyperlinked text extraStyles
19
- isLoading = false // shows a spinner on the left when true
18
+ isLoading = false, // shows a spinner on the left when true
19
+ dataQa = null,
20
+ actionTextPositionMobile = "outside" // whether action text is outside/below box or inside it
20
21
  }) => {
21
22
  const { isMobile } = useContext(ThemeContext);
22
23
 
@@ -49,7 +50,7 @@ const WalletName = ({
49
50
  mainText && <Text>{mainText}</Text>
50
51
  )}
51
52
  </Box>
52
- {!isMobile && (
53
+ {(actionTextPositionMobile === "inside" || !isMobile) && (
53
54
  <Box padding="0">
54
55
  {text && <Text variant="pXS">{text}</Text>}
55
56
  {(text || actionText) && <>&nbsp;</>}
@@ -57,6 +58,7 @@ const WalletName = ({
57
58
  <ButtonWithAction
58
59
  disabled={disableAction}
59
60
  text={actionText}
61
+ dataQa={dataQa}
60
62
  action={action}
61
63
  variant="smallGhost"
62
64
  extraStyles={`
@@ -71,7 +73,7 @@ const WalletName = ({
71
73
  )}
72
74
  </Cluster>
73
75
  </Module>
74
- {isMobile && (
76
+ {!!isMobile && actionTextPositionMobile === "outside" && (
75
77
  <Cluster
76
78
  align="center"
77
79
  justify={text || actionText ? "flex-end" : "flex-start"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import WalletName from "./WalletName";
3
- import { text, object, boolean } from "@storybook/addon-knobs";
3
+ import { text, object, boolean, select } from "@storybook/addon-knobs";
4
4
  import page from "../../../../.storybook/page";
5
5
 
6
6
  export const walletName = () => {
@@ -12,6 +12,31 @@ export const walletName = () => {
12
12
  text={text("text", "Not you?", "props")}
13
13
  disableAction={boolean("disableAction", false, "props")}
14
14
  isLoading={boolean("isLoading", false, "props")}
15
+ actionTextPositionMobile={select(
16
+ "actionTextPositionMobile",
17
+ { inside: "inside", outside: "outside" },
18
+ "outside",
19
+ "props"
20
+ )}
21
+ />
22
+ );
23
+ };
24
+
25
+ export const walletNameWithOverrides = () => {
26
+ return (
27
+ <WalletName
28
+ mainText={text("mainText", "Firstname Lastname", "props")}
29
+ action={object("action", () => window.alert("action fired!"), "props")}
30
+ actionText={text("actionText", "Check out as a guest", "props")}
31
+ text={text("text", "Not you?", "props")}
32
+ disableAction={boolean("disableAction", false, "props")}
33
+ isLoading={boolean("isLoading", false, "props")}
34
+ actionTextPositionMobile={select(
35
+ "actionTextPositionMobile",
36
+ { inside: "inside", outside: "outside" },
37
+ "outside",
38
+ "props"
39
+ )}
15
40
  />
16
41
  );
17
42
  };
@@ -9,6 +9,8 @@ export interface WalletNameProps {
9
9
  text?: string | null;
10
10
  isLoading: boolean;
11
11
  buttonExtraStyles?: string;
12
+ dataQa?: string | null;
13
+ actionTextPositionMobile?: "inside" | "outside";
12
14
  }
13
15
 
14
16
  export const WalletName: React.FC<Expand<WalletNameProps> &
@@ -48,10 +48,6 @@ const PaymentDetailsActions = ({
48
48
  setDetailedObligation(obligations, config, obligationAssocID);
49
49
  navigateToDetailedObligation(detailsSlug);
50
50
  };
51
- const handlePayNowClick = disableActions
52
- ? noop
53
- : () => handleClick(obligations);
54
-
55
51
  return (
56
52
  <Box
57
53
  padding={isMobile ? "0" : "16px 0 0"}
@@ -153,7 +149,7 @@ const PaymentDetailsActions = ({
153
149
  <Box padding={"0"}>
154
150
  <ButtonWithAction
155
151
  isLoading={isLoading}
156
- action={handlePayNowClick}
152
+ action={disableActions ? noop : () => handleClick(obligations)}
157
153
  text="Pay Now"
158
154
  variant={isMobile ? "smallSecondary" : "secondary"}
159
155
  dataQa="Pay Now"
@@ -166,7 +162,7 @@ const PaymentDetailsActions = ({
166
162
  <Box padding="8px 0 0" width="100%">
167
163
  <ButtonWithAction
168
164
  isLoading={isLoading}
169
- action={handlePayNowClick}
165
+ action={disableActions ? noop : () => handleClick(obligations)}
170
166
  text="Pay Now"
171
167
  variant={isMobile ? "smallSecondary" : "secondary"}
172
168
  dataQa="Pay Now"
@@ -25,7 +25,9 @@ const PaymentButtonBar = ({
25
25
  hideBackButton = false,
26
26
  buttonGroupStyles,
27
27
  hideAdditionalButton = false,
28
- additionalButton
28
+ additionalButton,
29
+ nextButtonTestId = null,
30
+ backButtonTestId = null
29
31
  }) => {
30
32
  const { isMobile } = useContext(ThemeContext);
31
33
 
@@ -36,7 +38,7 @@ const PaymentButtonBar = ({
36
38
  url={cancelURL}
37
39
  variant={backButtonVariant}
38
40
  extraStyles={isMobile && "flex-grow: 1"}
39
- dataQa={cancelText}
41
+ dataQa={backButtonTestId || cancelText}
40
42
  aria-labelledby={`${kebabCaseString(cancelText)}-button`}
41
43
  role="link"
42
44
  />
@@ -60,7 +62,7 @@ const PaymentButtonBar = ({
60
62
  text={redirectText}
61
63
  variant={forwardButtonVariant}
62
64
  extraStyles={isMobile && "flex-grow: 1"}
63
- dataQa={redirectText}
65
+ dataQa={nextButtonTestId || redirectText}
64
66
  disabled={isForwardButtonDisabled}
65
67
  aria-labelledby={`${kebabCaseString(redirectText)}-button`}
66
68
  role={forwardButtonAriaRole}
@@ -73,7 +75,7 @@ const PaymentButtonBar = ({
73
75
  action={forwardButtonAction}
74
76
  isLoading={forwardButtonLoading}
75
77
  extraStyles={isMobile && "flex-grow: 1"}
76
- dataQa={forwardButtonText}
78
+ dataQa={nextButtonTestId || forwardButtonText}
77
79
  disabled={isForwardButtonDisabled}
78
80
  aria-labelledby={`${kebabCaseString(forwardButtonText)}-button`}
79
81
  role={forwardButtonAriaRole}
@@ -58,6 +58,7 @@ const RadioSection = ({
58
58
  ariaDescribedBy,
59
59
  isSectionRequired = false,
60
60
  groupedSections,
61
+ borderOverride,
61
62
  ...rest
62
63
  }) => {
63
64
  const [focused, setFocused] = useState(null);
@@ -98,7 +99,7 @@ const RadioSection = ({
98
99
  return (
99
100
  <Box
100
101
  padding="1px"
101
- border={`1px solid ${themeValues.borderColor}`}
102
+ border={borderOverride || `1px solid ${themeValues.borderColor}`}
102
103
  borderRadius="4px"
103
104
  extraStyles={containerStyles}
104
105
  role="radiogroup"
@@ -3,14 +3,22 @@ import { ThemeContext } from "styled-components";
3
3
  import Heading from "../../atoms/heading";
4
4
  import Paragraph from "../../atoms/paragraph";
5
5
  import { Box, Cluster } from "../../atoms/layouts";
6
- import { GRECIAN_GREY, CHARADE_GREY, WHITE } from "../../../constants/colors";
6
+ import { CHARADE_GREY, WHITE } from "../../../constants/colors";
7
7
  import ButtonWithLink from "../../atoms/button-with-link";
8
8
  import { ForgotPasswordIcon } from "../../atoms/icons";
9
9
  import withWindowSize from "../../withWindowSize";
10
10
  import { FormContainer, FormInputColumn } from "../../atoms/form-layouts";
11
+ import { fallbackValues } from "./ResetConfirmationForm.theme";
12
+ import { createThemeValues } from "../../../util/themeUtils";
11
13
 
12
14
  const ResetConfirmationForm = () => {
13
- const { isMobile } = useContext(ThemeContext);
15
+ const themeContext = useContext(ThemeContext);
16
+ const themeValues = createThemeValues(
17
+ themeContext,
18
+ fallbackValues,
19
+ "ResetConfirmationForm"
20
+ );
21
+ const { isMobile } = themeContext;
14
22
 
15
23
  return (
16
24
  <Box
@@ -20,7 +28,11 @@ const ResetConfirmationForm = () => {
20
28
  background={WHITE}
21
29
  boxShadow="0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
22
30
  >
23
- <Box background={GRECIAN_GREY} minWidth="100%" padding="0.5rem">
31
+ <Box
32
+ background={themeValues.bannerBackgroundColor}
33
+ minWidth="100%"
34
+ padding="0.5rem"
35
+ >
24
36
  <Cluster justify="center" align="center">
25
37
  <ForgotPasswordIcon />
26
38
  </Cluster>
@@ -0,0 +1,9 @@
1
+ import { colors } from "../../../constants";
2
+
3
+ const { GRECIAN_GREY } = colors;
4
+
5
+ const bannerBackgroundColor = GRECIAN_GREY;
6
+
7
+ export const fallbackValues = {
8
+ bannerBackgroundColor
9
+ };
@@ -3,14 +3,22 @@ import { ThemeContext } from "styled-components";
3
3
  import Heading from "../../atoms/heading";
4
4
  import Paragraph from "../../atoms/paragraph";
5
5
  import { Box, Cluster } from "../../atoms/layouts";
6
- import { GRECIAN_GREY, CHARADE_GREY, WHITE } from "../../../constants/colors";
6
+ import { CHARADE_GREY, WHITE } from "../../../constants/colors";
7
7
  import ButtonWithLink from "../../atoms/button-with-link";
8
8
  import { ForgotPasswordIcon } from "../../atoms/icons";
9
9
  import withWindowSize from "../../withWindowSize";
10
10
  import { FormContainer, FormInputColumn } from "../../atoms/form-layouts";
11
+ import { fallbackValues } from "./ResetPasswordSuccess.theme";
12
+ import { createThemeValues } from "../../../util/themeUtils";
11
13
 
12
- const ResetConfirmationForm = () => {
13
- const { isMobile } = useContext(ThemeContext);
14
+ const ResetPasswordSuccess = () => {
15
+ const themeContext = useContext(ThemeContext);
16
+ const themeValues = createThemeValues(
17
+ themeContext,
18
+ fallbackValues,
19
+ "ResetPasswordSuccess"
20
+ );
21
+ const { isMobile } = themeContext;
14
22
 
15
23
  return (
16
24
  <Box
@@ -20,7 +28,11 @@ const ResetConfirmationForm = () => {
20
28
  background={WHITE}
21
29
  boxShadow="0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
22
30
  >
23
- <Box background={GRECIAN_GREY} minWidth="100%" padding="0.5rem">
31
+ <Box
32
+ background={themeValues.bannerBackgroundColor}
33
+ minWidth="100%"
34
+ padding="0.5rem"
35
+ >
24
36
  <Cluster justify="center" align="center">
25
37
  <ForgotPasswordIcon />
26
38
  </Cluster>
@@ -53,4 +65,4 @@ const ResetConfirmationForm = () => {
53
65
  </Box>
54
66
  );
55
67
  };
56
- export default withWindowSize(ResetConfirmationForm);
68
+ export default withWindowSize(ResetPasswordSuccess);
@@ -0,0 +1,9 @@
1
+ import { colors } from "../../../constants";
2
+
3
+ const { GRECIAN_GREY } = colors;
4
+
5
+ const bannerBackgroundColor = GRECIAN_GREY;
6
+
7
+ export const fallbackValues = {
8
+ bannerBackgroundColor
9
+ };