@transferwise/components 0.0.0-experimental-77f3fcf → 0.0.0-experimental-72aed20

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.
Files changed (34) hide show
  1. package/build/index.esm.js +31 -60
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +31 -60
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/main.css +1 -1
  7. package/build/styles/promoCard/PromoCard.css +1 -1
  8. package/build/types/common/Option/Option.d.ts.map +1 -1
  9. package/build/types/common/card/Card.d.ts.map +1 -1
  10. package/build/types/common/card/index.d.ts +0 -1
  11. package/build/types/common/card/index.d.ts.map +1 -1
  12. package/build/types/dateInput/DateInput.d.ts +2 -0
  13. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  14. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  15. package/build/types/promoCard/PromoCard.d.ts +3 -9
  16. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  17. package/build/types/promoCard/PromoCardIndicator.d.ts +3 -5
  18. package/build/types/promoCard/PromoCardIndicator.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
  21. package/src/card/Card.spec.js +2 -2
  22. package/src/common/Option/Option.tsx +1 -7
  23. package/src/common/card/Card.tsx +2 -6
  24. package/src/common/card/index.ts +0 -1
  25. package/src/dateInput/DateInput.js +8 -0
  26. package/src/dateInput/DateInput.story.tsx +2 -0
  27. package/src/main.css +1 -1
  28. package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
  29. package/src/promoCard/PromoCard.css +1 -1
  30. package/src/promoCard/PromoCard.less +9 -9
  31. package/src/promoCard/PromoCard.spec.tsx +0 -1
  32. package/src/promoCard/PromoCard.story.tsx +30 -90
  33. package/src/promoCard/PromoCard.tsx +22 -69
  34. package/src/promoCard/PromoCardIndicator.tsx +8 -20
@@ -157,6 +157,7 @@ const PhoneNumberInput = (props) => {
157
157
  <div className={`input-group input-group-${size}`}>
158
158
  <input
159
159
  id={id}
160
+ autoComplete="tel-national"
160
161
  name="phoneNumber"
161
162
  inputMode="numeric"
162
163
  value={internalValue.suffix}
@@ -1 +1 @@
1
- .np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-description{color:#5d7079;color:var(--color-content-secondary)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon .tw-icon{color:var(--Card-indicator-icon-color)}[dir=rtl] .np-Card-indicatorIcon .tw-icon{transform:scaleX(-1)}.np-Card--checked,.np-Card--link{box-shadow:none;color:currentColor;cursor:pointer;transform:scale(1);transition:box-shadow .2s ease-in-out,transform .5s ease-in-out}.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--checked,.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--link{--Card-box-shadow:0px 20px var(--size-40) 0px var(--color-background-neutral);--Card-check-color:var(--color-interactive-accent)}.np-Card--checked.is-disabled,.np-Card--link.is-disabled{cursor:not-allowed}@media (prefers-reduced-motion:reduce){.np-Card--checked,.np-Card--link{transition:none}}.np-Card--checked:hover:not(.is-disabled,:disabled,.is-checked,:focus-within),.np-Card--link:hover:not(.is-disabled,:disabled,.is-checked,:focus-within){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow)}.np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral-active);--Card-image-scale:1.1;--Card-image-translate:var(--size-8);box-shadow:var(--Card-box-shadow);transform:scale(98%)}.np-theme-personal--bright-green .np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-theme-personal--bright-green .np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral)}.np-Card--checked:focus-visible:not(.is-disabled,:disabled),.np-Card--checked:has(:focus-visible):not(.np-Card--checked),.np-Card--link:focus-visible:not(.is-disabled,:disabled),.np-Card--link:has(:focus-visible):not(.np-Card--checked){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow);outline:var(--ring-outline-color) solid 4px;outline:var(--ring-outline-color) solid var(--size-4);outline-offset:4px;outline-offset:var(--size-4)}.np-Card--checked:has(.np-Card-closeButton:focus-visible),.np-Card--link:has(.np-Card-closeButton:focus-visible){outline:none}.np-Card--link .np-Card-titleLink{color:#37517e;color:var(--color-content-primary);text-decoration:none}.np-Card--link .np-Card-titleLink:focus-visible{outline:none}.np-Card--link .np-Card-titleLink:after{content:"";display:block;height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.np-Card--checked.is-checked{box-shadow:0 0 0 4px var(--color-interactive-primary);box-shadow:0 0 0 var(--size-4) var(--color-interactive-primary)}.np-Card--checked.is-checked .np-Card-check{align-items:center;background:var(--Card-check-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-check-color);display:flex;height:40px;height:var(--size-40);justify-content:center;position:absolute;right:8px;right:var(--size-8);top:8px;top:var(--size-8);width:40px;width:var(--size-40)}[dir=rtl] .np-Card--checked.is-checked .np-Card-check{left:8px;left:var(--size-8);right:auto}.np-Card--checked.is-checked:focus-visible:not(.is-disabled,:disabled){box-shadow:none}.np-CardGroup{display:flex;flex-direction:column;gap:24px;gap:var(--size-24);width:100%}@media (min-width:768px){.np-CardGroup{flex-direction:row}}.np-CardGroup .np-Card.np-Card--promoCard{max-width:100%}
1
+ .np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon{align-items:center;background:var(--Card-indicator-icon-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-indicator-icon-color);display:inline-block;display:flex;height:56px;height:var(--size-56);justify-content:center;width:56px;width:var(--size-56)}[dir=rtl] .np-Card-indicatorIcon{transform:scaleX(-1)}.np-Card--checked,.np-Card--link{box-shadow:none;color:currentColor;cursor:pointer;transform:scale(1);transition:box-shadow .2s ease-in-out,transform .5s ease-in-out}.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--checked,.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--link{--Card-box-shadow:0px 20px var(--size-40) 0px var(--color-background-neutral);--Card-check-color:var(--color-interactive-accent)}.np-Card--checked.is-disabled,.np-Card--link.is-disabled{cursor:not-allowed}@media (prefers-reduced-motion:reduce){.np-Card--checked,.np-Card--link{transition:none}}.np-Card--checked:hover:not(.is-disabled,:disabled,.is-checked,:focus-within),.np-Card--link:hover:not(.is-disabled,:disabled,.is-checked,:focus-within){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow)}.np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral-active);--Card-image-scale:1.1;--Card-image-translate:var(--size-8);box-shadow:var(--Card-box-shadow);transform:scale(98%)}.np-theme-personal--bright-green .np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-theme-personal--bright-green .np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral)}.np-Card--checked:focus-visible:not(.is-disabled,:disabled),.np-Card--checked:has(:focus-visible):not(.np-Card--checked),.np-Card--link:focus-visible:not(.is-disabled,:disabled),.np-Card--link:has(:focus-visible):not(.np-Card--checked){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow);outline:var(--ring-outline-color) solid 4px;outline:var(--ring-outline-color) solid var(--size-4);outline-offset:4px;outline-offset:var(--size-4)}.np-Card--link .np-Card-titleLink{color:#37517e;color:var(--color-content-primary);text-decoration:none}.np-Card--link .np-Card-titleLink:focus-visible{outline:none}.np-Card--link .np-Card-titleLink:after{content:"";display:block;height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.np-Card--checked.is-checked{box-shadow:0 0 0 4px var(--color-interactive-primary);box-shadow:0 0 0 var(--size-4) var(--color-interactive-primary)}.np-Card--checked.is-checked .np-Card-check{align-items:center;background:var(--Card-check-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-check-color);display:flex;height:40px;height:var(--size-40);justify-content:center;position:absolute;right:8px;right:var(--size-8);top:8px;top:var(--size-8);width:40px;width:var(--size-40)}[dir=rtl] .np-Card--checked.is-checked .np-Card-check{left:8px;left:var(--size-8);right:auto}.np-Card--checked.is-checked:focus-visible:not(.is-disabled,:disabled){box-shadow:none}.np-CardGroup{display:flex;flex-direction:column;gap:24px;gap:var(--size-24);width:100%}@media (min-width:768px){.np-CardGroup{flex-direction:row}}.np-CardGroup .np-Card.np-Card--promoCard{max-width:100%}
@@ -32,10 +32,6 @@
32
32
  right: calc(var(--size-24) * -1);
33
33
  }
34
34
  }
35
-
36
- &-description {
37
- color: var(--color-content-secondary);
38
- }
39
35
 
40
36
  &-indicator {
41
37
  position: absolute;
@@ -58,8 +54,16 @@
58
54
  border-radius: 100px;
59
55
  }
60
56
 
61
- &Icon .tw-icon {
57
+ &Icon {
62
58
  color: var(--Card-indicator-icon-color);
59
+ width: var(--size-56);
60
+ height: var(--size-56);
61
+ display: inline-block;
62
+ background: var(--Card-indicator-icon-background-color);
63
+ border-radius: var(--radius-full);
64
+ display: flex;
65
+ justify-content: center;
66
+ align-items: center;
63
67
 
64
68
  // Flips icon for right to left content
65
69
  [dir="rtl"] & {
@@ -119,10 +123,6 @@
119
123
  outline-offset: var(--size-4);
120
124
  box-shadow: var(--Card-box-shadow);
121
125
  }
122
-
123
- &:has(.np-Card-closeButton:focus-visible) {
124
- outline: none;
125
- }
126
126
  }
127
127
 
128
128
  &--link {
@@ -11,7 +11,6 @@ describe('PromoCard', () => {
11
11
  description: 'Test Description',
12
12
  indicatorLabel: 'Test Indicator Label',
13
13
  testId: 'test-promo-card',
14
- children: 'Test Content',
15
14
  };
16
15
 
17
16
  let rerenderPromoCard: (props?: PromoCardProps) => void;
@@ -1,15 +1,11 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
- import { StarFill } from '@transferwise/icons';
3
2
 
4
- import PromoCard, { PromoCardCheckedProps, PromoCardLinkProps } from './PromoCard';
3
+ import PromoCard from './PromoCard';
5
4
 
6
5
  const meta: Meta<typeof PromoCard> = {
7
6
  component: PromoCard,
8
7
  title: 'Layouts/PromoCard',
9
8
  tags: ['autodocs'],
10
- parameters: {
11
- actions: { argTypesRegex: null },
12
- },
13
9
  };
14
10
 
15
11
  export default meta;
@@ -26,110 +22,54 @@ export const Default: Story = {
26
22
 
27
23
  export const Link: Story = {
28
24
  args: {
29
- ...Default.args,
30
- href: '#',
31
- } as PromoCardLinkProps,
32
- };
33
-
34
- export const TaskCard: Story = {
35
- args: {
36
- ...Link.args,
37
- title: 'Add money for when you need it',
38
- description: 'Get ready to send and spend.',
39
- indicatorLabel: undefined,
40
- imageSource: undefined,
41
- onDismiss: () => {
42
- alert('Dismissed!');
43
- },
44
- onClick: () => {
45
- alert('Clicked!');
46
- },
47
- isSmall: true,
48
- useDisplayFont: false,
49
- className: 'taskCard',
50
- } as PromoCardLinkProps,
51
- decorators: [
52
- (Story) => (
53
- <div>
54
- <style>
55
- {`
56
- .storybook-container {
57
- background-color: var(--color-background-neutral);
58
- }
59
-
60
- .taskCard {
61
- background-color: var(--color-background-screen);
62
- position: relative;
63
- width: 208px;
64
- height: 268px;
65
- }
66
-
67
- .taskCard .np-Card-title {
68
- margin-top: var(--size-24);
69
- }
70
-
71
-
72
- .taskCard.np-Card--link:hover:not(.is-disabled, :disabled, :focus-within) {
73
- box-shadow: none;
74
- background-color: var(--color-background-screen-hover);
75
- }
76
-
77
- .taskCard.np-Card--link:active:not(.is-disabled, :disabled) {
78
- box-shadow: none;
79
- background-color: var(--color-background-screen-hover);
80
- }
81
- `}
82
- </style>
83
- <Story />
84
- </div>
85
- ),
86
- ],
87
- };
88
-
89
- export const TaskCardWithCustomIcon: Story = {
90
- args: {
91
- ...TaskCard.args,
92
- indicatorIcon: <StarFill size={24} aria-hidden="true" />,
93
- } as PromoCardLinkProps,
94
- decorators: TaskCard.decorators,
95
- };
96
-
97
- export const TaskCardCompleted: Story = {
98
- args: {
99
- ...TaskCard.args,
100
- onDismiss: undefined,
101
- href: undefined,
102
- indicatorIcon: 'check',
103
- className: 'taskCard taskCard--completed np-theme--personal np-theme-personal--forest-green',
104
- } as PromoCardLinkProps,
105
- decorators: TaskCard.decorators,
25
+ description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
26
+ title: 'Digital',
27
+ href: 'https://wise.com',
28
+ indicatorLabel: 'Free',
29
+ imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
30
+ },
106
31
  };
107
32
 
108
33
  export const Check: Story = {
109
34
  args: {
110
- ...Default.args,
35
+ description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
36
+ title: 'Digital',
111
37
  type: 'checkbox',
112
- } as PromoCardCheckedProps,
38
+ indicatorLabel: 'Free',
39
+ imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
40
+ },
113
41
  };
114
42
 
115
43
  export const DefaultChecked: Story = {
116
44
  args: {
117
- ...Check.args,
45
+ description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
46
+ title: 'Digital',
47
+ type: 'checkbox',
48
+ indicatorLabel: 'Free',
118
49
  defaultChecked: true,
119
- } as PromoCardCheckedProps,
50
+ imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
51
+ },
120
52
  };
121
53
 
122
54
  export const Disabled: Story = {
123
55
  args: {
124
- ...Check.args,
56
+ description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
57
+ title: 'Digital',
58
+ type: 'checkbox',
125
59
  isDisabled: true,
60
+ indicatorLabel: 'Free',
61
+ imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp',
126
62
  },
127
63
  };
128
64
 
129
65
  export const CustomClass: Story = {
130
66
  args: {
131
- ...Link.args,
67
+ description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
68
+ title: 'Digital',
69
+ href: 'https://wise.com',
132
70
  className: 'np-CustomPromoCard',
71
+ indicatorLabel: 'Free',
72
+ imageSource: 'https://wise.com/web-art/assets/illustrations/digital-card-medium@2x.webp',
133
73
  },
134
74
  decorators: [
135
75
  (Story) => (
@@ -138,8 +78,8 @@ export const CustomClass: Story = {
138
78
  {`
139
79
  .np-CustomPromoCard {
140
80
  --Card-background-color: var(--color-bright-yellow);
141
- --Card-indicator-icon-background-color: var(--color-background-neutral);
142
- --color-interactive-control: var(--color-primary);
81
+ --Card-indicator-icon-background-color: var(--color-dark-gold);
82
+ --Card-indicator-icon-color: var(--color-contrast);
143
83
  }
144
84
  `}
145
85
  </style>
@@ -1,16 +1,15 @@
1
1
  import { Check } from '@transferwise/icons';
2
2
  import classNames from 'classnames';
3
- import React, { forwardRef, FunctionComponent, ReactElement, useEffect, useState } from 'react';
3
+ import React, { forwardRef, FunctionComponent, useState, useEffect, useMemo } from 'react';
4
4
 
5
5
  import Body from '../body';
6
6
  import { Typography } from '../common';
7
- import Card, { CardProps } from '../common/card';
7
+ import Card from '../common/card';
8
8
  import Display from '../display';
9
9
  import Image from '../image/Image';
10
- import Title from '../title';
11
10
 
12
11
  import { usePromoCardContext } from './PromoCardContext';
13
- import PromoCardIndicator, { PromoCardIndicatorProps } from './PromoCardIndicator';
12
+ import PromoCardIndicator from './PromoCardIndicator';
14
13
 
15
14
  export type ReferenceType = React.Ref<HTMLInputElement>;
16
15
  export type LinkTarget = '_blank' | '_parent' | '_self' | '_top';
@@ -50,9 +49,6 @@ export interface PromoCardCommonProps {
50
49
  /** Optional prop to specify text for the indicator label of the PromoCard */
51
50
  indicatorLabel?: string;
52
51
 
53
- /** Optional prop to specify the icon for the indicator icon of the PromoCard */
54
- indicatorIcon?: PromoCardIndicatorProps['icon'];
55
-
56
52
  /** Optional prop to specify an image alt text */
57
53
  imageAlt?: string;
58
54
 
@@ -60,7 +56,7 @@ export interface PromoCardCommonProps {
60
56
  imageClass?: string;
61
57
 
62
58
  /** Optional prop to specify an image source url */
63
- imageSource?: string;
59
+ imageSource: string;
64
60
 
65
61
  /** Specify whether the PromoCard is disabled, or not */
66
62
  isDisabled?: boolean;
@@ -73,12 +69,9 @@ export interface PromoCardCommonProps {
73
69
 
74
70
  /** Required prop to specify the title text of the PromoCard */
75
71
  title: string;
76
-
77
- /** Set to false to use body font style for the title */
78
- useDisplayFont?: boolean;
79
72
  }
80
73
 
81
- export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
74
+ export interface PromoCardLinkProps extends PromoCardCommonProps {
82
75
  /**
83
76
  * Optional prop to prompts a user to save the linked URL instead of
84
77
  * navigating to it
@@ -109,7 +102,7 @@ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps
109
102
  value?: never;
110
103
  }
111
104
 
112
- export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
105
+ export interface PromoCardCheckedProps extends PromoCardCommonProps {
113
106
  /** Specify the initial checked attribute of the PromoCard */
114
107
  defaultChecked?: boolean;
115
108
 
@@ -213,7 +206,6 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
213
206
  imageClass,
214
207
  imageSource,
215
208
  indicatorLabel,
216
- indicatorIcon,
217
209
  isChecked,
218
210
  isDisabled,
219
211
  onClick,
@@ -224,8 +216,6 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
224
216
  title,
225
217
  type,
226
218
  value,
227
- isSmall,
228
- useDisplayFont = true,
229
219
  ...props
230
220
  },
231
221
  reference,
@@ -251,25 +241,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
251
241
  // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
252
242
  // `'download'` if `download` is truthy. If neither condition is true, set
253
243
  // `icon` to `undefined`.
254
-
255
- // Create a function to get icon type
256
- const getIconType = () => {
257
- if (indicatorIcon) {
258
- return indicatorIcon;
259
- }
260
-
261
- if (download) {
262
- return 'download';
263
- }
264
-
265
- if (href && !type) {
266
- return 'arrow';
267
- }
268
-
269
- return undefined;
270
- };
271
-
272
- const CardTitle = useDisplayFont ? Display : Title;
244
+ const icon = href && download ? 'download' : href ? 'arrow' : undefined;
273
245
 
274
246
  // Define all class names string based on the values of the `href`, `type`,
275
247
  // `checked`, and `className` props.
@@ -289,7 +261,6 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
289
261
  onClick,
290
262
  ref: reference,
291
263
  'data-testid': testId,
292
- isSmall,
293
264
  };
294
265
 
295
266
  // Object with Anchor props that will be passed to the `a` element. These
@@ -327,33 +298,6 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
327
298
  }
328
299
  : {};
329
300
 
330
- const getTitle = () => {
331
- const titleContent =
332
- href && !type ? (
333
- <a className="np-Card-titleLink" {...anchorProps}>
334
- {title}
335
- </a>
336
- ) : (
337
- title
338
- );
339
-
340
- const titleProps = {
341
- id: `${componentId}-title`,
342
- as: headingLevel,
343
- className: 'np-Card-title',
344
- };
345
-
346
- return useDisplayFont ? (
347
- <Display type={Typography.DISPLAY_SMALL} {...titleProps}>
348
- {titleContent}
349
- </Display>
350
- ) : (
351
- <Title type={Typography.TITLE_SUBSECTION} {...titleProps}>
352
- {titleContent}
353
- </Title>
354
- );
355
- };
356
-
357
301
  useEffect(() => {
358
302
  setChecked(defaultChecked ?? isChecked ?? false);
359
303
  }, [defaultChecked, isChecked]);
@@ -365,18 +309,27 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
365
309
  <Check size={24} aria-hidden="true" />
366
310
  </span>
367
311
  )}
368
-
369
- {getTitle()}
370
-
312
+ <Display
313
+ id={`${componentId}-title`}
314
+ as={headingLevel}
315
+ className="np-Card-title"
316
+ type={Typography.DISPLAY_SMALL}
317
+ >
318
+ {href && !type ? (
319
+ <a className="np-Card-titleLink" {...anchorProps}>
320
+ {title}
321
+ </a>
322
+ ) : (
323
+ title
324
+ )}
325
+ </Display>
371
326
  <Body className="np-Card-description">{description}</Body>
372
-
373
327
  {imageSource && (
374
328
  <div className={classNames('np-Card-image', { imageClass })}>
375
329
  <Image src={imageSource} alt={imageAlt || ''} loading="lazy" />
376
330
  </div>
377
331
  )}
378
-
379
- <PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />
332
+ <PromoCardIndicator label={indicatorLabel} icon={icon} />
380
333
  </Card>
381
334
  );
382
335
  },
@@ -1,8 +1,7 @@
1
1
  import { ArrowRight, Check, Download } from '@transferwise/icons';
2
2
  import classNames from 'classnames';
3
- import { ReactElement, ReactNode } from 'react';
3
+ import { ReactNode } from 'react';
4
4
 
5
- import Avatar, { AvatarType } from '../avatar';
6
5
  import Body from '../body';
7
6
  import { Typography } from '../common';
8
7
 
@@ -14,10 +13,7 @@ export type PromoCardIndicatorProps = {
14
13
  label?: string;
15
14
 
16
15
  /** Optional icon to display in the indicator. */
17
- icon?: 'check' | 'arrow' | 'download' | ReactElement;
18
-
19
- /** Optional prop to specify whether the indicator is sized small or not. */
20
- isSmall?: boolean;
16
+ icon?: 'check' | 'arrow' | 'download';
21
17
 
22
18
  /** Optional ID to add to the indicator container for testing purposes. */
23
19
  testid?: string;
@@ -35,7 +31,7 @@ export type PromoCardIndicatorProps = {
35
31
  *
36
32
  * @param {string} className - Optional class name(s) to add to the indicator container.
37
33
  * @param {string} label - Optional label to display next to the indicator.
38
- * @param {string | ReactElement} icon - Optional icon to display in the indicator.
34
+ * @param {string} icon - Optional icon to display in the indicator.
39
35
  * @param {string} testid - Optional ID to add to the indicator container for testing purposes.
40
36
  * @param {ReactNode} children - Optional children to display inside the indicator.
41
37
  * @returns {JSX.Element} - The PromoCardIndicator component.
@@ -47,14 +43,11 @@ const PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({
47
43
  children,
48
44
  label,
49
45
  icon,
50
- isSmall = false,
51
46
  testid,
52
47
  ...rest
53
48
  }) => {
54
- const isIconString = icon && typeof icon === 'string';
55
-
56
49
  const IconComponent =
57
- isIconString &&
50
+ icon &&
58
51
  {
59
52
  check: Check,
60
53
  arrow: ArrowRight,
@@ -68,15 +61,10 @@ const PromoCardIndicator: React.FC<PromoCardIndicatorProps> = ({
68
61
  {label}
69
62
  </Body>
70
63
  )}
71
- {icon && (
72
- <Avatar
73
- type={AvatarType.ICON}
74
- size={isSmall ? 40 : 56}
75
- backgroundColor="var(--Card-indicator-icon-background-color)"
76
- className="np-Card-indicatorIcon"
77
- >
78
- {IconComponent ? <IconComponent size={24} aria-hidden="true" /> : icon}
79
- </Avatar>
64
+ {IconComponent && (
65
+ <span className="np-Card-indicatorIcon">
66
+ <IconComponent size={24} aria-hidden="true" />
67
+ </span>
80
68
  )}
81
69
  {children}
82
70
  </div>