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

chore: updating header to use heading sm #29308

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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 @@ -14,16 +14,8 @@ exports[`NFT full image should match snapshot 1`] = `
<div
class="mm-box mm-header-base multichain-page-header mm-box--padding-4 mm-box--display-flex mm-box--justify-content-center mm-box--width-full"
>
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
/>
</div>
Comment on lines -17 to -23
Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Dec 29, 2024

Choose a reason for hiding this comment

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

Removes empty p and div tag when children is not present as in the example of the NFT details page header

Screenshot 2024-12-29 at 3 54 07 PM

<div
class="mm-box mm-box--display-flex mm-box--justify-content-flex-end"
style="min-width: 0px;"
>
<button
aria-label="Back"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ const ConnectedAccountsPermissions = ({ permissions }) => {
padding={0}
backgroundColor={BackgroundColor.backgroundDefault}
>
<Text
onClick={toggleExpanded}
as="h6"
variant={TextVariant.bodyMdMedium}
>
<Text onClick={toggleExpanded} variant={TextVariant.bodyMdMedium}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removes incorrect h6 tag

{t('permissions')}
</Text>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ exports[`Connections Content should render correctly 1`] = `
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
<div
class="mm-box connections-header__title mm-box--display-flex mm-box--gap-2 mm-box--justify-content-center mm-box--align-items-center"
Expand All @@ -40,12 +40,12 @@ exports[`Connections Content should render correctly 1`] = `
style="mask-image: url('./images/icons/global.svg');"
/>
<span
class="mm-box mm-text mm-text--heading-md mm-text--ellipsis mm-text--text-align-center mm-box--color-text-default"
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--color-text-default"
>
metamask.github.io
</span>
</div>
</p>
</h2>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const Connections = () => {
)}
<Text
as="span"
variant={TextVariant.headingMd}
variant={TextVariant.headingSm}
textAlign={TextAlign.Center}
ellipsis
>
Expand Down
25 changes: 14 additions & 11 deletions ui/components/multichain/pages/page/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ export const Header = ({
endAccessory={endAccessory}
{...props}
>
<Text
display={Display.Block}
variant={TextVariant.bodyMdBold}
textAlign={TextAlign.Center}
paddingInlineStart={8}
paddingInlineEnd={8}
ellipsis
{...textProps}
>
{children}
</Text>
{children && (
<Text
as="h2"
display={Display.Block}
variant={TextVariant.headingSm}
textAlign={TextAlign.Center}
paddingInlineStart={8}
paddingInlineEnd={8}
ellipsis
{...textProps}
>
{children}
</Text>
)}
Comment on lines +57 to +70
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding logic to only render the h2 tag if children exist see ui/components/app/assets/nfts/nft-details/snapshots/nft-full-image.test.js.snap

</HeaderBase>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ exports[`All Connections render renders correctly 1`] = `
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating to use heading sm and more correct semantic html

class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
<span
class="mm-box mm-text mm-text--heading-md mm-text--text-align-center mm-box--color-text-default"
>
Permissions
</span>
</p>
Permissions
</h2>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,7 @@ export const PermissionsPage = () => {
/>
}
>
<Text
as="span"
variant={TextVariant.headingMd}
textAlign={TextAlign.Center}
>
{t('permissions')}
</Text>
Comment on lines -80 to -86
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing extra html element to reduce html bloat and to maintain heading consistency

{t('permissions')}
</Header>
<Content padding={0}>
<Box ref={headerRef}></Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ exports[`ReviewPermissions should render correctly 1`] = `
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
<div
class="mm-box connections-header__title mm-box--display-flex mm-box--gap-2 mm-box--justify-content-center mm-box--align-items-center"
Expand All @@ -40,10 +40,10 @@ exports[`ReviewPermissions should render correctly 1`] = `
style="mask-image: url('./images/icons/global.svg');"
/>
<span
class="mm-box mm-text mm-text--heading-md mm-text--ellipsis mm-text--text-align-center mm-box--color-text-default"
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--color-text-default"
/>
</div>
</p>
</h2>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ exports[`SendPage render and initialization should render correctly even when a
<div
class="mm-box"
>
<h4
<h2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating header tag

class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
Send
</h4>
</h2>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const PermissionsHeader = ({
)}
<Text
as="span"
variant={TextVariant.headingMd}
variant={TextVariant.headingSm}
textAlign={TextAlign.Center}
ellipsis
>
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/bridge/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ exports[`Bridge renders the component with initial props 1`] = `
<div
class="mm-box"
>
<h4
<h2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating header tag

class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
Bridge
</h4>
</h2>
</div>
<div
class="mm-box mm-box--display-flex mm-box--justify-content-flex-end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ exports[`ConnectPage should render correctly 1`] = `
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
<h2
class="mm-box mm-text mm-text--heading-lg mm-box--color-text-default"
Expand All @@ -29,7 +29,7 @@ exports[`ConnectPage should render correctly 1`] = `
This site wants to
:
</p>
</p>
</h2>
</div>
</div>
<div
Expand Down Expand Up @@ -265,8 +265,8 @@ exports[`ConnectPage should render with defaults from the requested permissions
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
>
<h2
class="mm-box mm-text mm-text--heading-lg mm-box--color-text-default"
Expand All @@ -279,7 +279,7 @@ exports[`ConnectPage should render with defaults from the requested permissions
This site wants to
:
</p>
</p>
</h2>
</div>
</div>
<div
Expand Down
Loading