Skip to content

Update Text to use TS version of Box#19572

Closed
georgewrmarshall wants to merge 1 commit intodevelopfrom
fix/19569/update-text-with-ts-box
Closed

Update Text to use TS version of Box#19572
georgewrmarshall wants to merge 1 commit intodevelopfrom
fix/19569/update-text-with-ts-box

Conversation

@georgewrmarshall
Copy link
Copy Markdown
Contributor

@georgewrmarshall georgewrmarshall commented Jun 12, 2023

Explanation

Currently the Text component still uses the JS version of the Box component and blocks TypeScript migration. This PR updates the Text component to use the TS version of the Box component. I've also added a few Before/After screenshots in the code comments to ensure no visual regression

Screenshots/Screencaps

Before

Showing original Text component in storybook to show no visual regressions

before.mov

After

Showing updated Text component in storybook using the TS version of the Box 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 replace Typography with Text section and linked the issue

after.mov

Manual Testing Steps

  • I've added a few screenshots in the code comments to show no visual regressions between develop and the updates in this PR

To check storybook

  • Go to the latest build of storybook in this PR
  • Search Text in the search panel
  • Check the controls, stories and docs are working as expected.

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

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.

@github-actions
Copy link
Copy Markdown
Contributor

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.

Comment thread ui/components/component-library/avatar-base/avatar-base.tsx
Comment thread ui/components/component-library/avatar-base/avatar-base.types.ts
* Additional props to pass to the `Text` component used for the `title` text
*/
titleProps: PropTypes.shape(Text.PropTypes),
titleProps: PropTypes.object,
Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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

color: var(--color-text-default);
font-family: var(--font-family-sans);

&:is(strong),
Copy link
Copy Markdown
Contributor Author

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

@georgewrmarshall georgewrmarshall self-assigned this Jun 12, 2023
@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Jun 12, 2023
class="mm-box mm-text beta-header__message mm-text--body-sm mm-box--color-warning-inverse"
>
<span>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-12 at 1 19 38 PM Screenshot 2023-06-12 at 1 35 23 PM

@georgewrmarshall georgewrmarshall force-pushed the fix/19569/update-text-with-ts-box branch from f99f22f to 66a9dc5 Compare June 13, 2023 15:14
@georgewrmarshall georgewrmarshall added the DO-NOT-MERGE Pull requests that should not be merged label Jun 13, 2023
@georgewrmarshall georgewrmarshall force-pushed the fix/19569/update-text-with-ts-box branch from 66a9dc5 to 0339946 Compare June 13, 2023 20:56
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-13 at 2 01 29 PM Screenshot 2023-06-13 at 2 02 12 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-13 at 2 03 33 PM Screenshot 2023-06-13 at 2 03 49 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-13 at 2 04 44 PM Screenshot 2023-06-13 at 2 04 57 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-13 at 2 05 53 PM Screenshot 2023-06-13 at 2 06 08 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-13 at 2 07 02 PM Screenshot 2023-06-13 at 2 07 17 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-06-13 at 2 08 09 PM Screenshot 2023-06-13 at 2 08 23 PM

@georgewrmarshall georgewrmarshall force-pushed the fix/19569/update-text-with-ts-box branch 2 times, most recently from 762ccd7 to c348964 Compare June 13, 2023 21:46
Comment thread ui/components/component-library/text/README.mdx Outdated
Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 13, 2023

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

Copy link
Copy Markdown
Contributor Author

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.

Screenshot 2023-06-13 at 3 02 10 PM

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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

Comment on lines 63 to 67
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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.

@georgewrmarshall georgewrmarshall force-pushed the fix/19569/update-text-with-ts-box branch 2 times, most recently from 727b6bd to 837b5d2 Compare June 15, 2023 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

team-design-system All issues relating to design system in Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Text component to use TS version of Box

3 participants