@transferwise/components 0.0.0-experimental-1a9f157 → 0.0.0-experimental-3ab1d06
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/build/avatar/Avatar.js +0 -2
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +0 -2
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +0 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +0 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +3 -1
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +3 -1
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/circle/Circle.js +3 -19
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +3 -19
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +7 -1
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +7 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/main.css +22 -6
- package/build/popover/Popover.js +6 -1
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +7 -2
- package/build/popover/Popover.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +4 -4
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -4
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/circularButton/CircularButton.css +2 -2
- package/build/styles/common/circle/Circle.css +0 -4
- package/build/styles/main.css +22 -6
- package/build/styles/statusIcon/StatusIcon.css +20 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -9
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +6 -4
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +2 -6
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.spec.tsx +1 -3
- package/src/avatar/Avatar.tsx +0 -2
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -11
- package/src/badge/Badge.spec.tsx +1 -3
- package/src/badge/Badge.tsx +1 -1
- package/src/circularButton/CircularButton.css +2 -2
- package/src/circularButton/CircularButton.less +1 -1
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +20 -20
- package/src/common/bottomSheet/BottomSheet.tsx +4 -2
- package/src/common/circle/Circle.css +0 -4
- package/src/common/circle/Circle.less +0 -8
- package/src/common/circle/Circle.tsx +3 -36
- package/src/common/responsivePanel/ResponsivePanel.tsx +13 -3
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
- package/src/main.css +22 -6
- package/src/overlayHeader/OverlayHeader.spec.tsx +1 -3
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -2
- package/src/popover/Popover.spec.tsx +64 -21
- package/src/popover/Popover.story.tsx +54 -42
- package/src/popover/Popover.tsx +12 -5
- package/src/popover/__snapshots__/Popover.spec.tsx.snap +2 -0
- package/src/promoCard/PromoCard.spec.tsx +1 -3
- package/src/radio/Radio.rtl.spec.tsx +1 -2
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -2
- package/src/statusIcon/StatusIcon.css +20 -0
- package/src/statusIcon/StatusIcon.less +17 -0
- package/src/statusIcon/StatusIcon.spec.tsx +21 -3
- package/src/statusIcon/StatusIcon.story.tsx +8 -31
- package/src/statusIcon/StatusIcon.tsx +6 -11
|
@@ -1,54 +1,66 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { select } from '@storybook/addon-knobs';
|
|
3
2
|
|
|
4
3
|
import Button from '../button';
|
|
5
4
|
import { Position } from '../common';
|
|
6
5
|
|
|
7
6
|
import Popover from './Popover';
|
|
7
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
8
|
+
|
|
9
|
+
type Story = StoryObj<typeof Popover>;
|
|
10
|
+
|
|
11
|
+
const Content = () => (
|
|
12
|
+
<>
|
|
13
|
+
You’ll get this rate as long as we receive your 10 EUR within the next 51 hours.
|
|
14
|
+
<div>
|
|
15
|
+
<a href="test1">Test 1</a>
|
|
16
|
+
</div>
|
|
17
|
+
<div>
|
|
18
|
+
<a href="test1">Test 2</a>
|
|
19
|
+
</div>
|
|
20
|
+
<div>
|
|
21
|
+
<a href="test1">Test 3</a>
|
|
22
|
+
</div>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
8
25
|
|
|
9
26
|
export default {
|
|
10
27
|
component: Popover,
|
|
11
28
|
title: 'Dialogs/Popover',
|
|
12
|
-
|
|
29
|
+
tags: ['autodocs'],
|
|
30
|
+
args: {
|
|
31
|
+
preferredPlacement: Position.BOTTOM,
|
|
32
|
+
title: 'Guaranteed rate',
|
|
33
|
+
content: <Content />,
|
|
34
|
+
children: <Button onClick={action(`I'm also triggered`)}>Click here to Open Popover!</Button>,
|
|
35
|
+
},
|
|
36
|
+
argTypes: {
|
|
37
|
+
preferredPlacement: {
|
|
38
|
+
control: 'select',
|
|
39
|
+
options: [Position.TOP, Position.RIGHT, Position.BOTTOM, Position.LEFT],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
} satisfies Meta<typeof Popover>;
|
|
13
43
|
|
|
14
|
-
export const Basic =
|
|
15
|
-
const preferredPlacement = select(
|
|
16
|
-
'preferredPlacement',
|
|
17
|
-
[
|
|
18
|
-
Position.TOP,
|
|
19
|
-
Position.RIGHT,
|
|
20
|
-
Position.BOTTOM,
|
|
21
|
-
Position.LEFT,
|
|
22
|
-
Position.LEFT_TOP,
|
|
23
|
-
Position.RIGHT_TOP,
|
|
24
|
-
Position.BOTTOM_RIGHT,
|
|
25
|
-
Position.BOTTOM_LEFT,
|
|
26
|
-
],
|
|
27
|
-
Position.TOP,
|
|
28
|
-
);
|
|
44
|
+
export const Basic: Story = {};
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</Popover>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
46
|
+
/**
|
|
47
|
+
* While it might be easier for sighted users to associate the content
|
|
48
|
+
* of a `Popover` with the surrounding and trigger content, it's likely
|
|
49
|
+
* much harder for people relying on the assistive-tech.
|
|
50
|
+
*
|
|
51
|
+
* For that reason, the `Popover` must always have an accessible name —
|
|
52
|
+
* if `title` prop is set, the component will use it automatically,
|
|
53
|
+
* otherwise `aria-label` must be provided instead.
|
|
54
|
+
*
|
|
55
|
+
* **NB:** If both props are provided, then screen readers will prioritise
|
|
56
|
+
* `aria-label` over `title`.
|
|
57
|
+
*/
|
|
58
|
+
export const WithoutVisibleTitle: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
preferredPlacement: Position.BOTTOM,
|
|
61
|
+
title: undefined,
|
|
62
|
+
'aria-label': 'Guaranteed rate',
|
|
63
|
+
content: <Content />,
|
|
64
|
+
children: <Button onClick={action(`I'm also triggered`)}>Click here to Open Popover!</Button>,
|
|
65
|
+
},
|
|
66
|
+
} satisfies Meta<typeof Popover>;
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTheme } from '@wise/components-theming';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { useRef, useState, cloneElement, useEffect, isValidElement } from 'react';
|
|
3
|
+
import { useRef, useState, cloneElement, useEffect, isValidElement, useId } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Position, Typography } from '../common';
|
|
6
6
|
import ResponsivePanel from '../common/responsivePanel';
|
|
@@ -23,11 +23,13 @@ export type PopoverPreferredPlacement =
|
|
|
23
23
|
|
|
24
24
|
export interface PopoverProps {
|
|
25
25
|
children?: React.ReactNode;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
title?: React.ReactNode;
|
|
27
|
+
/** Screen-reader-friendly title. Must be provided if `title` prop is not set. */
|
|
28
|
+
'aria-label'?: string;
|
|
28
29
|
preferredPlacement?: PopoverPreferredPlacement;
|
|
30
|
+
content: React.ReactNode;
|
|
29
31
|
onClose?: () => void;
|
|
30
|
-
|
|
32
|
+
className?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
function resolvePlacement(preferredPlacement: PopoverPreferredPlacement) {
|
|
@@ -50,7 +52,10 @@ export default function Popover({
|
|
|
50
52
|
preferredPlacement = Position.RIGHT,
|
|
51
53
|
title,
|
|
52
54
|
onClose,
|
|
55
|
+
'aria-label': ariaLabel,
|
|
53
56
|
}: PopoverProps) {
|
|
57
|
+
const titleId = useId();
|
|
58
|
+
|
|
54
59
|
const resolvedPlacement = resolvePlacement(preferredPlacement);
|
|
55
60
|
useEffect(() => {
|
|
56
61
|
if (resolvedPlacement !== preferredPlacement) {
|
|
@@ -81,6 +86,8 @@ export default function Popover({
|
|
|
81
86
|
: children}
|
|
82
87
|
</span>
|
|
83
88
|
<ResponsivePanel
|
|
89
|
+
aria-label={ariaLabel}
|
|
90
|
+
aria-labelledby={title && !ariaLabel ? titleId : undefined}
|
|
84
91
|
open={open}
|
|
85
92
|
anchorRef={anchorReference}
|
|
86
93
|
position={resolvedPlacement}
|
|
@@ -90,7 +97,7 @@ export default function Popover({
|
|
|
90
97
|
>
|
|
91
98
|
<div className="np-popover__content np-text-default-body">
|
|
92
99
|
{title && (
|
|
93
|
-
<Title type={Typography.TITLE_BODY} className="m-b-1">
|
|
100
|
+
<Title type={Typography.TITLE_BODY} id={titleId} className="m-b-1">
|
|
94
101
|
{title}
|
|
95
102
|
</Title>
|
|
96
103
|
)}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Popover on desktop renders when is open 1`] = `
|
|
4
4
|
<div
|
|
5
|
+
aria-labelledby=":r0:"
|
|
5
6
|
class="np-panel np-panel--open np-popover__container"
|
|
6
7
|
data-popper-escaped="true"
|
|
7
8
|
data-popper-placement="right"
|
|
@@ -17,6 +18,7 @@ exports[`Popover on desktop renders when is open 1`] = `
|
|
|
17
18
|
>
|
|
18
19
|
<h4
|
|
19
20
|
class="np-text-title-body m-b-1"
|
|
21
|
+
id=":r0:"
|
|
20
22
|
>
|
|
21
23
|
title
|
|
22
24
|
</h4>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { render, fireEvent, screen
|
|
1
|
+
import { render, fireEvent, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import PromoCard, { PromoCardProps, PromoCardCheckedProps, PromoCardLinkProps } from './PromoCard';
|
|
5
5
|
|
|
6
|
-
mockMatchMedia();
|
|
7
|
-
|
|
8
6
|
describe('PromoCard', () => {
|
|
9
7
|
const defaultProps = {
|
|
10
8
|
title: 'Test Title',
|
|
@@ -35,11 +35,11 @@ exports[`Radio shows the avatar when supplied 1`] = `
|
|
|
35
35
|
>
|
|
36
36
|
<div
|
|
37
37
|
class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
|
|
38
|
-
style="--circle-size: 48px;
|
|
38
|
+
style="--circle-size: 48px;"
|
|
39
39
|
>
|
|
40
40
|
<div
|
|
41
41
|
class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
|
|
42
|
-
style="--circle-size: 48px;
|
|
42
|
+
style="--circle-size: 48px;"
|
|
43
43
|
>
|
|
44
44
|
HD
|
|
45
45
|
</div>
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
.status-icon > svg {
|
|
2
|
+
height: 32px;
|
|
3
|
+
height: var(--size-32);
|
|
4
|
+
width: 32px;
|
|
5
|
+
width: var(--size-32);
|
|
6
|
+
}
|
|
1
7
|
.status-circle .light {
|
|
2
8
|
color: var(--color-contrast);
|
|
3
9
|
}
|
|
@@ -13,6 +19,20 @@
|
|
|
13
19
|
.np-theme-personal .status-circle.pending .status-icon {
|
|
14
20
|
color: var(--color-dark);
|
|
15
21
|
}
|
|
22
|
+
.status-circle-sm .status-icon > svg {
|
|
23
|
+
height: 14px;
|
|
24
|
+
height: var(--size-14);
|
|
25
|
+
width: 14px;
|
|
26
|
+
width: var(--size-14);
|
|
27
|
+
}
|
|
28
|
+
@media (max-width: 320px) {
|
|
29
|
+
.status-circle-sm .status-icon > svg {
|
|
30
|
+
width: 24px;
|
|
31
|
+
width: var(--size-24);
|
|
32
|
+
height: 24px;
|
|
33
|
+
height: var(--size-24);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
16
36
|
.status-circle.negative,
|
|
17
37
|
.status-circle.error {
|
|
18
38
|
background-color: var(--color-sentiment-negative);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
.status-icon > svg {
|
|
2
|
+
height: var(--size-32);
|
|
3
|
+
width: var(--size-32);
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.status-circle {
|
|
2
7
|
.light {
|
|
3
8
|
color: var(--color-contrast);
|
|
@@ -17,6 +22,18 @@
|
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
}
|
|
25
|
+
|
|
26
|
+
&-sm {
|
|
27
|
+
.status-icon > svg {
|
|
28
|
+
height: var(--size-14);
|
|
29
|
+
width: var(--size-14);
|
|
30
|
+
|
|
31
|
+
@media (--screen-400-zoom) {
|
|
32
|
+
width: var(--size-24);
|
|
33
|
+
height: var(--size-24);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
20
37
|
}
|
|
21
38
|
|
|
22
39
|
.status-circle.negative,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { Sentiment, Size } from '../common';
|
|
1
|
+
import { Sentiment, Size, SizeLarge, SizeMedium, SizeSmall } from '../common';
|
|
2
2
|
import { render, cleanup, screen, mockMatchMedia } from '../test-utils';
|
|
3
3
|
|
|
4
|
-
import StatusIcon
|
|
4
|
+
import StatusIcon from '.';
|
|
5
5
|
|
|
6
6
|
mockMatchMedia();
|
|
7
7
|
|
|
8
8
|
describe('StatusIcon', () => {
|
|
9
|
-
const renderStatusIcon = (props?:
|
|
9
|
+
const renderStatusIcon = (props?: {
|
|
10
|
+
sentiment?: Sentiment;
|
|
11
|
+
size?: SizeLarge | SizeMedium | SizeSmall;
|
|
12
|
+
}) => {
|
|
10
13
|
return render(
|
|
11
14
|
<StatusIcon
|
|
12
15
|
sentiment={props?.sentiment || Sentiment.NEUTRAL}
|
|
@@ -22,8 +25,23 @@ describe('StatusIcon', () => {
|
|
|
22
25
|
|
|
23
26
|
expect(screen.getByTestId('status-icon')).toHaveClass('neutral');
|
|
24
27
|
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle');
|
|
28
|
+
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-md');
|
|
25
29
|
});
|
|
26
30
|
|
|
31
|
+
it.each([
|
|
32
|
+
[Size.SMALL as const, 'status-circle-sm'],
|
|
33
|
+
[Size.MEDIUM as const, 'status-circle-md'],
|
|
34
|
+
[Size.LARGE as const, 'status-circle-lg'],
|
|
35
|
+
])(
|
|
36
|
+
"if prop 'size' equals '%s' is passed, renders the status icon with class '%s'",
|
|
37
|
+
(size, expectedClass) => {
|
|
38
|
+
renderStatusIcon({ size });
|
|
39
|
+
|
|
40
|
+
expect(screen.getByTestId('status-icon')).toHaveClass(expectedClass);
|
|
41
|
+
cleanup();
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
27
45
|
it.each([
|
|
28
46
|
[Sentiment.NEGATIVE, Sentiment.NEGATIVE],
|
|
29
47
|
[Sentiment.NEUTRAL, Sentiment.NEUTRAL],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Size, Sentiment } from '../common';
|
|
4
4
|
|
|
5
5
|
import StatusIcon from './StatusIcon';
|
|
6
6
|
|
|
@@ -11,45 +11,22 @@ export default {
|
|
|
11
11
|
|
|
12
12
|
type Story = StoryObj<typeof StatusIcon>;
|
|
13
13
|
|
|
14
|
-
export const
|
|
15
|
-
render: () => (
|
|
16
|
-
<span style={{ display: 'flex'
|
|
17
|
-
{
|
|
18
|
-
Sentiment.POSITIVE,
|
|
19
|
-
Sentiment.NEGATIVE,
|
|
20
|
-
Sentiment.WARNING,
|
|
21
|
-
Sentiment.NEUTRAL,
|
|
22
|
-
Sentiment.PENDING,
|
|
23
|
-
].map((sentiment) => {
|
|
24
|
-
return (
|
|
25
|
-
<span
|
|
26
|
-
key={sentiment}
|
|
27
|
-
style={{
|
|
28
|
-
display: 'flex',
|
|
29
|
-
justifyContent: 'space-between',
|
|
30
|
-
flexDirection: 'column',
|
|
31
|
-
minHeight: '150px',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{([16, 24, 32, 40, 48, 56, 72] as const).map((size) => {
|
|
36
|
-
return <StatusIcon key={size} size={size} sentiment={sentiment} />;
|
|
37
|
-
})}
|
|
38
|
-
</span>
|
|
39
|
-
);
|
|
40
|
-
})}
|
|
14
|
+
export const Basic: Story = {
|
|
15
|
+
render: (args) => (
|
|
16
|
+
<span style={{ display: 'flex' }}>
|
|
17
|
+
<StatusIcon {...args} />
|
|
41
18
|
</span>
|
|
42
19
|
),
|
|
43
20
|
};
|
|
44
21
|
|
|
45
|
-
export const
|
|
46
|
-
render: (
|
|
22
|
+
export const Variants: Story = {
|
|
23
|
+
render: () => (
|
|
47
24
|
<span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
|
|
48
25
|
{[
|
|
49
26
|
Sentiment.POSITIVE,
|
|
50
27
|
Sentiment.NEGATIVE,
|
|
51
|
-
Sentiment.WARNING,
|
|
52
28
|
Sentiment.NEUTRAL,
|
|
29
|
+
Sentiment.WARNING,
|
|
53
30
|
Sentiment.PENDING,
|
|
54
31
|
].map((sentiment) => {
|
|
55
32
|
return (
|
|
@@ -5,14 +5,9 @@ import { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '.
|
|
|
5
5
|
import Circle, { CircleProps } from '../common/circle';
|
|
6
6
|
import { useMedia } from '../common/hooks/useMedia';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead
|
|
10
|
-
*/
|
|
11
|
-
type LegacySizes = SizeSmall | SizeMedium | SizeLarge;
|
|
12
|
-
|
|
13
8
|
export type StatusIconProps = {
|
|
14
|
-
sentiment
|
|
15
|
-
size
|
|
9
|
+
sentiment: `${Sentiment}`;
|
|
10
|
+
size: SizeSmall | SizeMedium | SizeLarge;
|
|
16
11
|
};
|
|
17
12
|
|
|
18
13
|
const iconTypeMap = {
|
|
@@ -32,17 +27,17 @@ const mapLegacySize = {
|
|
|
32
27
|
[String(Size.LARGE)]: 48,
|
|
33
28
|
} satisfies Record<string, CircleProps['size']>;
|
|
34
29
|
|
|
35
|
-
const StatusIcon = ({ sentiment = 'neutral', size: sizeProp =
|
|
30
|
+
const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 'md' }: StatusIconProps) => {
|
|
36
31
|
const Icon = iconTypeMap[sentiment];
|
|
37
32
|
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
38
33
|
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
39
|
-
const size = mapLegacySize[sizeProp]
|
|
34
|
+
const size = sizeProp === Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];
|
|
40
35
|
return (
|
|
41
36
|
<Circle
|
|
42
37
|
as="span"
|
|
43
|
-
size={
|
|
38
|
+
size={size}
|
|
44
39
|
data-testid="status-icon"
|
|
45
|
-
className={clsx('status-circle', sentiment)}
|
|
40
|
+
className={clsx('status-circle', `status-circle-${sizeProp}`, sentiment)}
|
|
46
41
|
>
|
|
47
42
|
<Icon className={clsx('status-icon', iconColor)} />
|
|
48
43
|
</Circle>
|