metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

Replace deprecated Typography with Text component

Open georgewrmarshall opened this issue 2 years ago • 59 comments

Description

In an effort to reduce duplication and replace our old design system components with new components it would be great to replace all <Typography /> with <Text /> components. This is a massive undertaking by itself and creating a single PR would be too large. Instead this issue could be broken up into multiple PRs.

Technical Details

  • Swap all Typography components with Text equivalent(make sure to check the component apis as they are slightly different)
  • boxProps should be migrated appropriately e.g. boxProps={{marginTop: 1}} => marginTop={1}
  • Some TextVariant have bold font weight options which can be used instead of fontWeight={FONT_WEIGHT.BOLD} => variant={TextVariant.bodyMdBold}
  • Check the Typography => Text component map below for the correct variant prop values

Typography => Text component map

<Typography variant={TypographyVariant.H1}> => <Text variant={TextVariant.displayMd}> <Typography variant={TypographyVariant.H2}> => <Text variant={TextVariant.headingLg}> <Typography variant={TypographyVariant.H3}> => <Text variant={TextVariant.headingMd}> <Typography variant={TypographyVariant.H4}> => <Text variant={TextVariant.headingSm}> <Typography variant={TypographyVariant.H5}> => <Text variant={TextVariant.bodyMd}> <Typography variant={TypographyVariant.H6}> => <Text variant={TextVariant.bodySm}> <Typography variant={TypographyVariant.Paragraph}> => <Text variant={TextVariant.bodyMd} <Typography variant={TypographyVariant.H7}> => <Text variant={TextVariant.bodySm}> <Typography variant={TypographyVariant.H8}> => <Text variant={TextVariant.bodyXs}> <Typography variant={TypographyVariant.H9}> => <Text variant={TextVariant.bodyXs}>

Acceptance Criteria

  • All Typography components have been replaced with their Text equivalent
  • PR contains a minimum of 1 file and a maximum of 3 files
  • Add Before / After screenshots to your PR to ensure no visual regressions
  • Reference this issue in the description of your PR
  • All CI tests are passing jest, lint, e2e etc

PRs that don't meet the acceptance criteria may be closed.

References

Text component documentation

georgewrmarshall avatar Feb 09 '23 00:02 georgewrmarshall

Please take note that the current Text documentation will be out of date until https://github.com/MetaMask/metamask-extension/pull/17674 has been merged 🙏

georgewrmarshall avatar Feb 09 '23 01:02 georgewrmarshall

Hi, can I work on this?

itsAfnanAlam avatar Feb 10 '23 03:02 itsAfnanAlam

Hi @itsAfnanAlam, you're welcome to submit a PR toward this issue please title it Part of #17670: Replace Typography with Text component

georgewrmarshall avatar Feb 10 '23 16:02 georgewrmarshall

@georgewrmarshall, working on it. Thanks!

itsAfnanAlam avatar Feb 11 '23 06:02 itsAfnanAlam

hi @georgewrmarshall is it up for grabs? if yes can I?

Aathirajan avatar Feb 11 '23 07:02 Aathirajan

@Aathirajan I am working on it.

itsAfnanAlam avatar Feb 11 '23 07:02 itsAfnanAlam

Great! Glad you mentioned it.

Aathirajan avatar Feb 11 '23 08:02 Aathirajan

Hey @itsAfnanAlam and @Aathirajan, this issue is intended to be broken up in to multiple PRs for easy review. I'm listing files engineers would like to, or are working on in the description under "Files being currently converted". You could both comment on the files you would like to convert and I'll add them to the list. See example PR here https://github.com/MetaMask/metamask-extension/pull/17753

georgewrmarshall avatar Feb 14 '23 17:02 georgewrmarshall

@georgewrmarshall can you point out some files that need change first and we'll look into them? Here's some that I found:

  • \ui\components\app\add-network\add-network.js
  • \ui\components\app\advanced-gas-fee-popover\advanced-gas-fee-defaults\advanced-gas-fee-defaults.js
  • \ui\components\app\advanced-gas-fee-popover\advanced-gas-fee-gas-limit\advanced-gas-fee-gas-limit.js
  • \ui\components\app\approve-content-card\approve-content-card.js

We could work on these first.

sammaji avatar Feb 14 '23 21:02 sammaji

Hey @samyabrata-maji, some of those are being worked on see "Files currently being converted" at the bottom section in this issue.

Screenshot 2023-02-14 at 3 41 52 PM
  • \ui\components\app\add-network\add-network.js in-progress 🚫
  • \ui\components\app\advanced-gas-fee-popover\advanced-gas-fee-defaults\advanced-gas-fee-defaults.js available to work on ✅
  • \ui\components\app\advanced-gas-fee-popover\advanced-gas-fee-gas-limit\advanced-gas-fee-gas-limit.js available to work on ✅
  • \ui\components\app\approve-content-card\approve-content-card.js in-progress 🚫

I'll add your name to the list for the available files in that list thanks!

georgewrmarshall avatar Feb 14 '23 23:02 georgewrmarshall

Hey @georgewrmarshall are all the files being worked by other contributors? Could I contribute in any way?

spiritanand avatar Feb 15 '23 03:02 spiritanand

Hey @georgewrmarshall are all the files being worked by other contributors? Could I contribute in any way? There are other files that require changes. Screenshot 2023-02-15 181600 @spiritanand Just make sure to let us know which ones you would be working on 👍

sammaji avatar Feb 15 '23 13:02 sammaji

@samyabrata-maji I did not understand. Are the ones in the ss available for me to work on?

spiritanand avatar Feb 15 '23 13:02 spiritanand

@georgewrmarshall A quick update: I've been working on the following and changes have been made. However, I'm unable to add screenshots as "This conversation has been locked and limited to collaborators."

Yomna-J avatar Feb 15 '23 13:02 Yomna-J

@samyabrata-maji I did not understand. Are the ones in the ss available for me to work on?

Some of them are available. There are other files too that are not in the ss.

sammaji avatar Feb 15 '23 13:02 sammaji

Hey @spiritanand, you can do a search for <Typography in your code editor. Excluding the Typography folder itself(ui/components/ui/typography) There are 119 files you can choose from that need to be converted. So far the bottom section "Files currently being converted" at the bottom of this issue description is what is being worked on. So you can comment here on what file you would like to work on and I will add it to the list under your name.

  1. Search <Typography Screenshot 2023-02-15 at 8 05 01 AM

  2. Pick a file that has not been taken and IS NOT in this list

Screenshot 2023-02-15 at 8 10 26 AM
  1. Comment on this issue the file that you'd like to convert and I will add it to the description under your name

georgewrmarshall avatar Feb 15 '23 16:02 georgewrmarshall

Hey! @georgewrmarshall I worked on these files and made a pr #17766 can you check them please? metamask-extension\ui\components\app\asset-list\asset-list.js metamask-extension\ui\components\app\beta-header\index.js metamask-extension\ui\components\app\cancel-speedup-popover\cancel-speedup-popover.js metamask-extension\ui\components\app\confirm-page-container\confirm-page-container.component.js metamask-extension\ui\components\app\confirm-page-container\confirm-page-container-content\confirm-page-container-content.component.js

SawanKumarBhagat avatar Feb 15 '23 16:02 SawanKumarBhagat

Hey @georgewrmarshall , I would like to work on this issue.

ayushj1910 avatar Feb 15 '23 19:02 ayushj1910

Hey @ayushj1910, That's great! Please read the issue and comment thread for details 🙏

georgewrmarshall avatar Feb 15 '23 22:02 georgewrmarshall

Hey @georgewrmarshall , I am new to open source where do i start working on this issue?

moheet333 avatar Mar 01 '23 07:03 moheet333

Hey @moheet333, a great start would be

  • Get the extension running on your local machine by reading through the contributor docs
  • Carefully read through this issue
  • See example PR https://github.com/MetaMask/metamask-extension/pull/17753

georgewrmarshall avatar Mar 02 '23 20:03 georgewrmarshall

Hey @georgewrmarshall, I will get started with the file /ui/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.js and ui/pages/home/home.component.js. Please assign them to me.

spiritanand avatar Mar 06 '23 19:03 spiritanand

Hey @spiritanand, updated description and looking forward to your PRs. Thanks!

Screenshot 2023-03-06 at 2 11 13 PM

georgewrmarshall avatar Mar 06 '23 22:03 georgewrmarshall

Happy Holi 🎉 @georgewrmarshall

I have created a PR for the two files confirm-approve-content.component.js and home.component.js. Please have a look 🤞

spiritanand avatar Mar 08 '23 12:03 spiritanand

Hey @georgewrmarshall, Please add welcome.js and edit-gas-display.component.js under my tab. I will be working on them this weekend.

Also, should I create a new PR for them or add them in the same PR I created?

spiritanand avatar Mar 10 '23 16:03 spiritanand

Hey @spiritanand, please create a new PR it helps get approved updates in faster as well as prevent stale PRs which could be in danger of having merge conflicts if those files are update during the time the PR is open. Smaller PRs are almost always best! Will add those file next to your name. Cheers! One suggestion is to tackle components with .stories.js files so we can easily review your changes in isolation. Oh both have storybook files so that's great 💯

georgewrmarshall avatar Mar 10 '23 17:03 georgewrmarshall

Hey @georgewrmarshall is there any file through which I can contribute?

sambhavgupta0705 avatar Mar 13 '23 08:03 sambhavgupta0705

Hey @georgewrmarshall is there any file through which I can contribute?

@sambhavgupta0705 please read the above thread, there are many files you can contribute to by searching for <Typography> component in your fork.

For reference, see the already merged PR ⇒ #17753

All the best.

spiritanand avatar Mar 13 '23 17:03 spiritanand

Hey @georgewrmarshall is there any file through which I can contribute?

@sambhavgupta0705 please read the above thread, there are many files you can contribute to by searching for <Typography> component in your fork.

For reference, see the already merged PR ⇒ #17753

All the best.

Thanks @spiritanand

sambhavgupta0705 avatar Mar 13 '23 17:03 sambhavgupta0705

Just submitted my first PR for file - ui/components/app/create-new-vault/create-new-vault.js

sscode avatar Mar 13 '23 18:03 sscode