@thecb/components 11.6.6 → 11.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.6.6",
3
+ "version": "11.6.8-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",
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import VisaSmallIcon from "../icons/VisaSmallIcon";
3
+ import AmExSmallIcon from "../icons/AmExSmallIcon";
4
+ import DiscoverSmallIcon from "../icons/DiscoverSmallIcon";
5
+ import MasterCardSmallIcon from "../icons/MasterCardSmallIcon";
6
+ import GenericSmallIcon from "../icons/GenericSmallIcon";
7
+
8
+ const iconMap = {
9
+ visa: VisaSmallIcon,
10
+ master_card: MasterCardSmallIcon,
11
+ discover: DiscoverSmallIcon,
12
+ amex: AmExSmallIcon
13
+ };
14
+
15
+ const CardType = ({ type }) => {
16
+ const IconComponent = iconMap[type] || GenericSmallIcon;
17
+ return <IconComponent />;
18
+ };
19
+
20
+ export default CardType;
@@ -0,0 +1,3 @@
1
+ import CardType from "./CardType";
2
+
3
+ export default CardType;
@@ -1,6 +1,6 @@
1
1
  import React, { Fragment } from "react";
2
2
  import styled from "styled-components";
3
- import GenericCard from "../icons/GenericCard";
3
+ import CardType from "../card-type";
4
4
  import Text from "../text";
5
5
  import { Box, Stack } from "../layouts";
6
6
  import { fallbackValues } from "./FormattedCreditCard.theme";
@@ -22,6 +22,7 @@ export const CCIconWrapper = styled.div`
22
22
 
23
23
  const FormattedCreditCard = ({
24
24
  lastFour,
25
+ type,
25
26
  autoPay,
26
27
  expireDate,
27
28
  expirationStatus,
@@ -29,7 +30,7 @@ const FormattedCreditCard = ({
29
30
  }) => (
30
31
  <CreditCardWrapper>
31
32
  <CCIconWrapper>
32
- <GenericCard />
33
+ <CardType type={type} />
33
34
  </CCIconWrapper>
34
35
  <Stack childGap="0">
35
36
  <Box padding="0">
@@ -48,6 +48,7 @@ export { default as Title } from "./title";
48
48
  export { default as ToggleSwitch } from "./toggle-switch";
49
49
  export { default as TypeaheadInput } from "./typeahead-input";
50
50
  export { default as Card } from "./card";
51
+ export { default as CardType } from "./card-type";
51
52
  export { default as NavTabs } from "./nav-tabs";
52
53
  export { default as LoadingLine } from "./loading-line";
53
54
  export { default as WalletName } from "./wallet-name";
@@ -31,15 +31,20 @@ const PaymentButtonBar = ({
31
31
  }) => {
32
32
  const { isMobile } = useContext(ThemeContext);
33
33
 
34
+ // cancel URLs are external (back to client system)
35
+ const handleCancel = () => {
36
+ window.location.href = cancelURL;
37
+ };
38
+
34
39
  const backButton =
35
40
  !!cancelURL && !!cancelText ? (
36
- <ButtonWithLink
41
+ <ButtonWithAction
37
42
  text={cancelText}
38
- url={cancelURL}
43
+ action={handleCancel}
39
44
  variant={backButtonVariant}
40
45
  extraStyles={isMobile && "flex-grow: 1"}
41
46
  dataQa={backButtonTestId || cancelText}
42
- aria-labelledby={`${kebabCaseString(cancelText)}-button`}
47
+ aria-label={`${cancelText}, navigate back to previous site`}
43
48
  role="link"
44
49
  />
45
50
  ) : (
@@ -50,7 +55,7 @@ const PaymentButtonBar = ({
50
55
  action={backButtonAction}
51
56
  extraStyles={isMobile && "flex-grow: 1"}
52
57
  dataQa="Back"
53
- aria-labelledby="back-button"
58
+ aria-label={"Back, navigate to previous page"}
54
59
  role="link"
55
60
  />
56
61
  )