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

fix: center token icon #26013

Merged
merged 8 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`Token Cell should match snapshot 1`] = `
href="#"
>
<div
class="mm-box mm-badge-wrapper mm-box--margin-right-3 mm-box--display-inline-block"
class="mm-box mm-badge-wrapper multichain-token-list-item__badge mm-box--margin-right-3 mm-box--display-inline-block"
>
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-md mm-avatar-token mm-avatar-token--with-halo mm-text--body-sm mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`TokenListItem should render correctly 1`] = `
href="#"
>
<div
class="mm-box mm-badge-wrapper mm-box--margin-right-3 mm-box--display-inline-block"
class="mm-box mm-badge-wrapper multichain-token-list-item__badge mm-box--margin-right-3 mm-box--display-inline-block"
>
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-md mm-avatar-token mm-avatar-token--with-halo mm-text--body-sm mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
Expand Down
4 changes: 4 additions & 0 deletions ui/components/multichain/token-list-item/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
}
}
}

&__badge {
align-self: center;
}
Comment on lines +11 to +13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info: Added CSS rule to center the badge within the token list item.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding custom CSS is the right move here because the Box component doesn't currently support and alignSelf style utility prop

}
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export const TokenListItem = ({
/>
}
marginRight={3}
className="multichain-token-list-item__badge"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info: Added className attribute to BadgeWrapper for centering the token icon.

>
<AvatarToken
name={tokenSymbol}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ exports[`AssetPage should render a native asset 1`] = `
data-testid="multichain-token-list-button"
>
<div
class="mm-box mm-badge-wrapper mm-box--margin-right-3 mm-box--display-inline-block"
class="mm-box mm-badge-wrapper multichain-token-list-item__badge mm-box--margin-right-3 mm-box--display-inline-block"
>
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-md mm-avatar-token mm-avatar-token--with-halo mm-text--body-sm mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
Expand Down Expand Up @@ -462,7 +462,7 @@ exports[`AssetPage should render an ERC20 asset without prices 1`] = `
data-testid="multichain-token-list-button"
>
<div
class="mm-box mm-badge-wrapper mm-box--margin-right-3 mm-box--display-inline-block"
class="mm-box mm-badge-wrapper multichain-token-list-item__badge mm-box--margin-right-3 mm-box--display-inline-block"
>
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-md mm-avatar-token mm-avatar-token--with-halo mm-text--body-sm mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
Expand Down Expand Up @@ -939,7 +939,7 @@ exports[`AssetPage should render an ERC20 token with prices 1`] = `
data-testid="multichain-token-list-button"
>
<div
class="mm-box mm-badge-wrapper mm-box--margin-right-3 mm-box--display-inline-block"
class="mm-box mm-badge-wrapper multichain-token-list-item__badge mm-box--margin-right-3 mm-box--display-inline-block"
>
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-md mm-avatar-token mm-avatar-token--with-halo mm-text--body-sm mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
Expand Down