-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Update Text to use TS version of Box #19572
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@@ -91,15 +91,15 @@ BannerBase.propTypes = { | |||
/** | |||
* Additional props to pass to the `Text` component used for the `title` text | |||
*/ | |||
titleProps: PropTypes.shape(Text.PropTypes), | |||
titleProps: PropTypes.object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately using Text.propTypes
breaks so need to update proptypes to use generic object while during our migration process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a task captured for returning to PropTypes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a particular issues addressing the propTypes but is it possible to use types from a TypeScript component with PropTypes. The issue that would fix this in future ins the migration of the component to TypeScript
@@ -33,6 +33,7 @@ $text-variants: ( | |||
color: var(--color-text-default); | |||
font-family: var(--font-family-sans); | |||
|
|||
&:is(strong), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating so it's based on CSS not a prop
@@ -6,7 +6,7 @@ exports[`Beta Header should match snapshot 1`] = ` | |||
class="box beta-header box--padding-2 box--display-flex box--flex-direction-row box--align-items-center box--width-full box--background-color-warning-default" | |||
> | |||
<h6 | |||
class="box mm-text beta-header__message mm-text--body-sm box--flex-direction-row box--color-warning-inverse" | |||
class="mm-box mm-text beta-header__message mm-text--body-sm mm-box--color-warning-inverse" | |||
> | |||
<span> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f99f22f
to
66a9dc5
Compare
66a9dc5
to
0339946
Compare
> | ||
<span> | ||
|
||
This allows the third party to spend | ||
<h6 | ||
class="box mm-text custom-spending-cap__input-value-and-token-name mm-text--body-sm-bold box--flex-direction-row box--color-text-default" | ||
class="mm-box mm-text custom-spending-cap__input-value-and-token-name mm-text--body-sm-bold" | ||
> | ||
10 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> | ||
<span> | ||
<button | ||
class="box mm-text mm-button-base mm-button-link mm-button-link--size-auto mm-text--body-md mm-text--text-align-left box--display-inline-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-primary-default box--background-color-transparent" | ||
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-auto mm-text--body-md mm-text--text-align-left mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent" | ||
> | ||
Go to full screen to connect your Ledger. | ||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -54,7 +54,7 @@ exports[`Customize Nonce should match snapshot 1`] = ` | |||
> | |||
<h6 | |||
boxprops="[object Object]" | |||
class="box mm-text mm-text--body-sm mm-text--font-weight-bold box--flex-direction-row box--color-text-default" | |||
class="mm-box mm-text mm-text--body-sm mm-text--font-weight-bold" | |||
> | |||
Edit nonce | |||
</h6> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> | ||
Cancel | ||
</button> | ||
<button | ||
class="box mm-text mm-button-base mm-button-base--size-lg mm-button-base--disabled mm-button-base--block mm-button-primary mm-button-primary--disabled mm-text--body-md box--padding-right-4 box--padding-left-4 box--display-inline-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-primary-inverse box--background-color-primary-default box--rounded-pill" | ||
class="mm-box mm-text mm-button-base mm-button-base--size-lg mm-button-base--disabled mm-button-base--block mm-button-primary mm-button-primary--disabled mm-text--body-md mm-box--padding-right-4 mm-box--padding-left-4 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-inverse mm-box--background-color-primary-default mm-box--rounded-pill" | ||
disabled="" | ||
> | ||
Continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type="secondary" | ||
> | ||
Cancel | ||
</button> | ||
<button | ||
class="box mm-text mm-button-base mm-button-base--size-lg mm-button-base--disabled mm-button-primary mm-button-primary--disabled mm-text--body-md box--padding-right-4 box--padding-left-4 box--display-inline-flex box--flex-direction-row box--justify-content-center box--align-items-center box--width-1/2 box--color-primary-inverse box--background-color-primary-default box--rounded-pill" | ||
class="mm-box mm-text mm-button-base mm-button-base--size-lg mm-button-base--disabled mm-button-primary mm-button-primary--disabled mm-text--body-md mm-box--padding-right-4 mm-box--padding-left-4 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--width-1/2 mm-box--color-primary-inverse mm-box--background-color-primary-default mm-box--rounded-pill" | ||
disabled="" | ||
type="primary" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/> | ||
</div> | ||
<p | ||
class="box mm-text mm-text--body-md box--flex-direction-row box--color-text-alternative" | ||
class="mm-box mm-text mm-text--body-md mm-box--color-text-alternative" | ||
data-testid="multichain-token-list-item-value" | ||
> | ||
5.000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
762ccd7
to
c348964
Compare
.mm-text { | ||
// Set default styles | ||
color: var(--color-text-default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the CSS specificity of the Box has been fixed i.e the order of stylesheets has been updated. We should set the default by the utility prop so it this style doesn't override it
dir={textDirection} | ||
ref={ref} | ||
color={TextColor.textDefault} | ||
{...props} // TODO: Need to fix Box types to allow for spreading props |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still dealing with a TypeScript issue that complains about spreading props. This doesn't effect the functionality of the component and doesn't block the build so I'll create a ticket to look into it. Need some more time to look into it. I think as this doesn't effect anything else we move forward to unblock migration and I'll look into it in a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm why isn't it blocking the build 🤔 type errors should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible your editor's typescript process was just... slow on reading updates? I don't see the error on my end when I view this file
c348964
to
4f7c1e1
Compare
4f7c1e1
to
db05689
Compare
* HelpText also accepts all Text and Box props | ||
* HelpText also accepts all Box props | ||
*/ | ||
...Text.propTypes, | ||
...Box.propTypes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine and not that someone should be changing the variant but what happens if they do? Would the variant prop error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yes I think this should cause a temporary prop error while this component is still in JS. There is an open contributor PR to migrate it though so once this is merged I can assist with that.
727b6bd
to
837b5d2
Compare
5a7a058
to
7785e72
Compare
7785e72
to
992d5fd
Compare
830700f
to
a1ef6ef
Compare
a1ef6ef
to
80b0251
Compare
80b0251
to
f7ce1cf
Compare
Explanation
Currently the
Text
component still uses the JS version of theBox
component and blocks TypeScript migration. This PR updates theText
component to use the TS version of theBox
component. I've also added a few Before/After screenshots in the code comments to ensure no visual regressionScreenshots/Screencaps
Before
Showing original
Text
component in storybook to show no visual regressionsbefore.mov
After
Showing updated
Text
component in storybook using the TS version of theBox
component. Showing no visual regressions and all stories and controls are working as expected. I have made some small updates to more easily find the replaceTypography
withText
section and linked the issueafter.mov
Manual Testing Steps
develop
and the updates in this PRTo check storybook
Text
in the search panelPre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Board
label.In this case, a QA Engineer approval will be be required.