Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate-AvatarIcon #19023

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d3a501f
Migrate-AvatarIcon
thebinij May 5, 2023
02f8cf9
Merge branch 'develop' into #18883-Migrate-AvatarIcon
thebinij May 5, 2023
ba7a40b
Merge branch 'MetaMask:develop' into #18883-Migrate-AvatarIcon
thebinij May 5, 2023
f95a42b
fix depcheck issue
thebinij May 5, 2023
dc7686a
fix lint
thebinij May 5, 2023
af29692
Merge branch 'develop' into #18883-Migrate-AvatarIcon
thebinij May 8, 2023
58621a6
Label PRs based on the labels of the associated issue (#17603)
pedronfigueiredo May 8, 2023
881e8e8
Fix fail to reject multiple approval requests (#19050)
vinistevam May 8, 2023
2f6c61c
Update slider.component.js (#19035)
PrgrmrHarshShukla May 8, 2023
4a5a8f8
Changes to confirm-data and confirm-hexdata (#19041)
dhruvv173 May 8, 2023
89148d1
UX Multichain: Added extra margin for native token (#18988)
NidhiKJha May 8, 2023
c49862c
devDeps: [email protected]>2.1.1 (#18866)
legobeat May 8, 2023
b3dd20e
Working on some lint issues in 2 files. (#18633)
PrgrmrHarshShukla May 8, 2023
a7eb0b4
UX: Multichain: Account Details Fixes (#18999)
darkwing May 8, 2023
096e3cc
[MMI] adds mmi logic in home view (#18960)
zone-live May 8, 2023
7b47767
Part of #17670 & #18714: Replace Typography with Text component: nft-…
PrgrmrHarshShukla May 8, 2023
83a27e3
Fix #18916 - UX: Multichain: Network picker design updates (#18962)
darkwing May 8, 2023
3824841
UX: Multichain: Ensure network picker renders properly for long and s…
darkwing May 8, 2023
6f285f7
devDeps: [email protected]>4.27.6 (#18869)
legobeat May 8, 2023
6ffc516
Changes to custody-labels.js (#19038)
dhruvv173 May 8, 2023
13a68f5
UX: Multichain: Disable network and account picker when necessary (#1…
darkwing May 8, 2023
17ba54d
UX: Multichain: Update deprecated variables (#19058)
darkwing May 9, 2023
96722d5
Fix #19059 - Show network picker when locked (#19063)
darkwing May 9, 2023
368a644
Fix #19060 - Ensure there's multiple accounts before focusing search …
darkwing May 9, 2023
82bec3b
Fix popover scroll button WhatsNewPopup hiding (#19017)
dominikrudzki May 9, 2023
83450d3
UX Multichain: updated margin top for assets tab (#19071)
NidhiKJha May 9, 2023
9cb9632
Replaced all fa-icon-circle with INFO icon (#17539)
NidhiKJha May 9, 2023
9f3fbf3
Set network status to "unknown" when ID is invalid (#19068)
Gudahtt May 9, 2023
25c0e72
remove pre commit hook for branch names (#19077)
pedronfigueiredo May 9, 2023
83976bb
Made builds.yml variable errors more helpful (#19066)
ritave May 9, 2023
3e96600
Some style, accessibility and sematic html updates to modal sub compo…
georgewrmarshall May 9, 2023
fc92480
Adding ModalFocus component (#18979)
georgewrmarshall May 9, 2023
75243b3
Changes to edit-gas-display.component.js (#19037)
dhruvv173 May 10, 2023
d4ae39d
Part of #17670 & #18714: Replace Typography with Text component in to…
PrgrmrHarshShukla May 10, 2023
0ae9058
Adopt ApprovalType from core (#18567)
vinistevam May 10, 2023
c545e68
builds.yml: add env var EDITOR_URL (#19074)
legobeat May 10, 2023
f710af3
Re-enable tests for subscription-based RPC methods (#18994)
mcmire May 10, 2023
7b6231c
removed mmi fencing from copy icon in header (#19087)
NidhiKJha May 10, 2023
6d23752
Only recognize "blocked" status for built-in networks (#19069)
Gudahtt May 10, 2023
fbe2c7e
Fix script to build migrations by having it use the `.ts` template (#…
NicholasEllul May 10, 2023
803cd1b
feat: Refactor Transaction Confirmation selector (#18796)
OGPoyraz May 11, 2023
3329811
Add `getCurrentChainId` argument to `SignatureController` (#19078)
OGPoyraz May 11, 2023
3687861
fix: use approvals selector fn in permission selectors (#19095)
OGPoyraz May 11, 2023
8e98e7d
[FLASK] Create E2E test for snap_GetEntropy (#18998)
bowensanders May 11, 2023
6d7ba87
Fix mv3 beta build (#18690)
danjm Apr 26, 2023
76eea2f
Show Bridge button in TokenOverview component (#18630)
micaelae Apr 21, 2023
295ebda
Update outdated browser versions (#18721)
Gudahtt Apr 21, 2023
96614b5
Enable editing L2 gas on optimism (#18217)
jpuri Apr 26, 2023
7c9f592
Show Bridge button in TokenOverview component (#18630)
micaelae Apr 21, 2023
9b74b3b
Fixing issue with gasLimit in transaction being 0 (#18682)
jpuri Apr 21, 2023
e9c7bf5
revert yarn.lock changes
thebinij May 12, 2023
29b257d
rebasing
thebinij May 12, 2023
04015cd
replace old TEXT_ALIGN
thebinij May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

97 changes: 0 additions & 97 deletions ui/components/component-library/avatar-icon/avatar-icon.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import {
Size,
DISPLAY,
AlignItems,
BackgroundColor,
Expand All @@ -12,8 +12,9 @@ import Box from '../../ui/box/box';

import { IconName } from '..';

import { AvatarBaseSize } from '../avatar-base/avatar-base.types';
import README from './README.mdx';
import { AvatarIcon, AVATAR_ICON_SIZES } from '.';
import { AvatarIcon } from '.';

const marginSizeControlOptions = [
undefined,
Expand Down Expand Up @@ -48,7 +49,7 @@ export default {
},
size: {
control: 'select',
options: Object.values(AVATAR_ICON_SIZES),
options: Object.values(AvatarBaseSize),
},
backgroundColor: {
control: 'select',
Expand Down Expand Up @@ -83,24 +84,24 @@ export default {
},
},
args: {
size: Size.MD,
size: AvatarBaseSize.Md,
},
};
} as ComponentMeta<typeof AvatarIcon>;

const Template = (args) => {
return <AvatarIcon iconName={IconName.SwapHorizontal} {...args} />;
const Template: ComponentStory<typeof AvatarIcon> = (args) => {
return <AvatarIcon {...args} iconName={IconName.SwapHorizontal} />;
};

export const DefaultStory = Template.bind({});
DefaultStory.storyName = 'Default';

export const SizeStory = (args) => (
export const SizeStory: ComponentStory<typeof AvatarIcon> = (args) => (
<Box display={DISPLAY.FLEX} alignItems={AlignItems.baseline} gap={1}>
<AvatarIcon {...args} size={Size.XS} />
<AvatarIcon {...args} size={Size.SM} />
<AvatarIcon {...args} size={Size.MD} />
<AvatarIcon {...args} size={Size.LG} />
<AvatarIcon {...args} size={Size.XL} />
<AvatarIcon {...args} size={AvatarBaseSize.Xs} />
<AvatarIcon {...args} size={AvatarBaseSize.Sm} />
<AvatarIcon {...args} size={AvatarBaseSize.Md} />
<AvatarIcon {...args} size={AvatarBaseSize.Lg} />
<AvatarIcon {...args} size={AvatarBaseSize.Xl} />
</Box>
);
SizeStory.storyName = 'Size';
Expand All @@ -109,80 +110,82 @@ SizeStory.args = {
iconName: IconName.Confirmation,
};

export const IconNameStory = (args) => (
export const IconNameStory: ComponentStory<typeof AvatarIcon> = (args) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarIcon
color={IconColor.primaryDefault}
backgroundColor={BackgroundColor.primaryMuted}
iconName={IconName.SwapHorizontal}
{...args}
iconName={IconName.SwapHorizontal}
/>
<AvatarIcon
color={IconColor.successDefault}
backgroundColor={BackgroundColor.successMuted}
iconName={IconName.Confirmation}
{...args}
iconName={IconName.Confirmation}
/>
<AvatarIcon
color={IconColor.infoDefault}
backgroundColor={BackgroundColor.infoMuted}
iconName={IconName.Info}
{...args}
iconName={IconName.Info}
/>
<AvatarIcon
color={IconColor.warningDefault}
backgroundColor={BackgroundColor.warningMuted}
iconName={IconName.Warning}
{...args}
iconName={IconName.Warning}
/>
<AvatarIcon
color={IconColor.errorDefault}
backgroundColor={BackgroundColor.errorMuted}
iconName={IconName.Danger}
{...args}
iconName={IconName.Danger}
/>
</Box>
);

IconNameStory.storyName = 'Icon Name';

export const ColorAndBackgroundColor = (args) => (
export const ColorAndBackgroundColor: ComponentStory<typeof AvatarIcon> = (
args,
) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarIcon
color={IconColor.primaryDefault}
backgroundColor={BackgroundColor.primaryMuted}
iconName={IconName.SwapHorizontal}
{...args}
iconName={IconName.SwapHorizontal}
/>
<AvatarIcon
color={IconColor.primaryInverse}
backgroundColor={BackgroundColor.primaryDefault}
iconName={IconName.SwapHorizontal}
{...args}
iconName={IconName.SwapHorizontal}
/>
<AvatarIcon
color={IconColor.successDefault}
backgroundColor={BackgroundColor.successMuted}
iconName={IconName.Confirmation}
{...args}
iconName={IconName.Confirmation}
/>
<AvatarIcon
color={IconColor.infoDefault}
backgroundColor={BackgroundColor.infoMuted}
iconName={IconName.Info}
{...args}
iconName={IconName.Info}
/>
<AvatarIcon
color={IconColor.warningDefault}
backgroundColor={BackgroundColor.warningMuted}
iconName={IconName.Warning}
{...args}
iconName={IconName.Warning}
/>
<AvatarIcon
color={IconColor.errorDefault}
backgroundColor={BackgroundColor.errorMuted}
iconName={IconName.Danger}
{...args}
iconName={IconName.Danger}
/>
</Box>
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
BackgroundColor,
IconColor,
} from '../../../helpers/constants/design-system';
import { AvatarIcon, AVATAR_ICON_SIZES } from '.';
import { AvatarBaseSize } from '../avatar-base/avatar-base.types';
import { AvatarIcon } from '.';

describe('AvatarIcon', () => {
it('should render correctly', () => {
Expand All @@ -26,45 +27,45 @@ describe('AvatarIcon', () => {
<>
<AvatarIcon
iconName={IconName.SwapHorizontal}
size={AVATAR_ICON_SIZES.XS}
data-testid={AVATAR_ICON_SIZES.XS}
size={AvatarBaseSize.Xs}
data-testid={AvatarBaseSize.Xs}
/>
<AvatarIcon
iconName={IconName.SwapHorizontal}
size={AVATAR_ICON_SIZES.SM}
data-testid={AVATAR_ICON_SIZES.SM}
size={AvatarBaseSize.Sm}
data-testid={AvatarBaseSize.Sm}
/>
<AvatarIcon
iconName={IconName.SwapHorizontal}
size={AVATAR_ICON_SIZES.MD}
data-testid={AVATAR_ICON_SIZES.MD}
size={AvatarBaseSize.Md}
data-testid={AvatarBaseSize.Md}
/>
<AvatarIcon
iconName={IconName.SwapHorizontal}
size={AVATAR_ICON_SIZES.LG}
data-testid={AVATAR_ICON_SIZES.LG}
size={AvatarBaseSize.Lg}
data-testid={AvatarBaseSize.Lg}
/>
<AvatarIcon
iconName={IconName.SwapHorizontal}
size={AVATAR_ICON_SIZES.XL}
data-testid={AVATAR_ICON_SIZES.XL}
size={AvatarBaseSize.Xl}
data-testid={AvatarBaseSize.Xl}
/>
</>,
);
expect(getByTestId(AVATAR_ICON_SIZES.XS)).toHaveClass(
`mm-avatar-base--size-${AVATAR_ICON_SIZES.XS}`,
expect(getByTestId(AvatarBaseSize.Xs)).toHaveClass(
`mm-avatar-base--size-${AvatarBaseSize.Xs}`,
);
expect(getByTestId(AVATAR_ICON_SIZES.SM)).toHaveClass(
`mm-avatar-base--size-${AVATAR_ICON_SIZES.SM}`,
expect(getByTestId(AvatarBaseSize.Sm)).toHaveClass(
`mm-avatar-base--size-${AvatarBaseSize.Sm}`,
);
expect(getByTestId(AVATAR_ICON_SIZES.MD)).toHaveClass(
`mm-avatar-base--size-${AVATAR_ICON_SIZES.MD}`,
expect(getByTestId(AvatarBaseSize.Md)).toHaveClass(
`mm-avatar-base--size-${AvatarBaseSize.Md}`,
);
expect(getByTestId(AVATAR_ICON_SIZES.LG)).toHaveClass(
`mm-avatar-base--size-${AVATAR_ICON_SIZES.LG}`,
expect(getByTestId(AvatarBaseSize.Lg)).toHaveClass(
`mm-avatar-base--size-${AvatarBaseSize.Lg}`,
);
expect(getByTestId(AVATAR_ICON_SIZES.XL)).toHaveClass(
`mm-avatar-base--size-${AVATAR_ICON_SIZES.XL}`,
expect(getByTestId(AvatarBaseSize.Xl)).toHaveClass(
`mm-avatar-base--size-${AvatarBaseSize.Xl}`,
);
});

Expand Down Expand Up @@ -106,9 +107,11 @@ describe('AvatarIcon', () => {
);
});
it('should forward a ref to the root html element', () => {
const ref = React.createRef();
const ref = React.createRef<HTMLDivElement>();
render(<AvatarIcon iconName={IconName.SwapHorizontal} ref={ref} />);
expect(ref.current).not.toBeNull();
expect(ref.current.nodeName).toBe('DIV');
if (ref.current) {
expect(ref.current.nodeName).toBe('DIV');
}
});
});
Loading