Replace deprecated Typography with Text component
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
Typographycomponents withTextequivalent(make sure to check the component apis as they are slightly different) boxPropsshould be migrated appropriately e.g.boxProps={{marginTop: 1}}=>marginTop={1}- Some
TextVarianthave bold font weight options which can be used instead offontWeight={FONT_WEIGHT.BOLD}=>variant={TextVariant.bodyMdBold} - Check the
Typography=>Textcomponent map below for the correctvariantprop 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
Typographycomponents have been replaced with theirTextequivalent - 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
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 🙏
Hi, can I work on this?
Hi @itsAfnanAlam, you're welcome to submit a PR toward this issue please title it Part of #17670: Replace Typography with Text component
@georgewrmarshall, working on it. Thanks!
hi @georgewrmarshall is it up for grabs? if yes can I?
@Aathirajan I am working on it.
Great! Glad you mentioned it.
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 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.
Hey @samyabrata-maji, some of those are being worked on see "Files currently being converted" at the bottom section in this issue.
\ui\components\app\add-network\add-network.jsin-progress 🚫\ui\components\app\advanced-gas-fee-popover\advanced-gas-fee-defaults\advanced-gas-fee-defaults.jsavailable to work on ✅\ui\components\app\advanced-gas-fee-popover\advanced-gas-fee-gas-limit\advanced-gas-fee-gas-limit.jsavailable to work on ✅\ui\components\app\approve-content-card\approve-content-card.jsin-progress 🚫
I'll add your name to the list for the available files in that list thanks!
Hey @georgewrmarshall are all the files being worked by other contributors? Could I contribute in any way?
Hey @georgewrmarshall are all the files being worked by other contributors? Could I contribute in any way? There are other files that require changes.
@spiritanand Just make sure to let us know which ones you would be working on 👍
@samyabrata-maji I did not understand. Are the ones in the ss available for me to work on?
@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."
ui/components/app/add-network/add-network.js@Yomna-J Part of #17670: Replace Typography with Text component #17681ui/components/app/confirm-page-container/confirm-page-container.component.js@Yomna-J Part of #17670: Replace Typography with Text component #17681
@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.
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.
-
Search
<Typography
-
Pick a file that has not been taken and IS NOT in this list
- Comment on this issue the file that you'd like to convert and I will add it to the description under your name
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
Hey @georgewrmarshall , I would like to work on this issue.
Hey @ayushj1910, That's great! Please read the issue and comment thread for details 🙏
Hey @georgewrmarshall , I am new to open source where do i start working on this issue?
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
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.
Hey @spiritanand, updated description and looking forward to your PRs. Thanks!
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 🤞
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?
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 💯
Hey @georgewrmarshall is there any file through which I can contribute?
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.
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
Just submitted my first PR for file - ui/components/app/create-new-vault/create-new-vault.js
@spiritanand Just make sure to let us know which ones you would be working on 👍