-
-
Notifications
You must be signed in to change notification settings - Fork 8
feat(DSYS-489): Migrate Text to ADR-0003 and ADR-0004 #1047
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
Changes from all commits
994f818
41f5cc0
8367f37
d7682b1
d056c15
aea3ae6
b0ffbbd
e07a0a8
3415877
59ebe72
c7a5357
e2afa45
c9371d0
ccbe933
f0d0155
b39ab31
0d90f12
8140310
fdd2124
0553ad0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ const designSystemPreset = require('@metamask/design-system-tailwind-preset'); | |
| module.exports = { | ||
| presets: [designSystemPreset], | ||
| content: [ | ||
| '../../packages/design-system-shared/src/**/*.{js,jsx,ts,tsx}', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does Before this migration, |
||
| '../../packages/design-system-react/src/**/*.{js,jsx,ts,tsx}', | ||
| '../../packages/design-tokens/stories/**/*.{js,jsx,ts,tsx,mdx}', | ||
| './src/**/*.{js,jsx,ts,tsx}', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,4 @@ | ||
| import { typography } from '@metamask/design-tokens'; | ||
|
|
||
| import { FontWeight, TextVariant } from '../../types'; | ||
| import { FontWeight, TextVariant } from '@metamask/design-system-shared'; | ||
|
|
||
| // Mappings | ||
| export const TWCLASSMAP_TEXT_FONTWEIGHT: { | ||
|
|
@@ -11,25 +9,21 @@ export const TWCLASSMAP_TEXT_FONTWEIGHT: { | |
| [FontWeight.Bold]: '-bold', | ||
| }; | ||
|
|
||
| export const MAP_TEXT_VARIANT_FONTWEIGHT: { | ||
| export const TWCLASSMAP_TEXT_VARIANT_FONTWEIGHT: { | ||
| [key in TextVariant]: FontWeight; | ||
| } = { | ||
| [TextVariant.DisplayLg]: typography.sDisplayLG.fontWeight as FontWeight, | ||
| [TextVariant.DisplayMd]: typography.sDisplayMD.fontWeight as FontWeight, | ||
| [TextVariant.HeadingLg]: typography.sHeadingLG.fontWeight as FontWeight, | ||
| [TextVariant.HeadingMd]: typography.sHeadingMD.fontWeight as FontWeight, | ||
| [TextVariant.HeadingSm]: typography.sHeadingSM.fontWeight as FontWeight, | ||
| [TextVariant.BodyLg]: typography.sBodyLGMedium.fontWeight as FontWeight, | ||
| [TextVariant.BodyMd]: typography.sBodyMD.fontWeight as FontWeight, | ||
| [TextVariant.BodySm]: typography.sBodySM.fontWeight as FontWeight, | ||
| [TextVariant.BodyXs]: typography.sBodyXS.fontWeight as FontWeight, | ||
| [TextVariant.PageHeading]: typography.sPageHeading.fontWeight as FontWeight, | ||
| [TextVariant.SectionHeading]: typography.sSectionHeading | ||
| .fontWeight as FontWeight, | ||
| [TextVariant.ButtonLabelMd]: typography.sButtonLabelMd | ||
| .fontWeight as FontWeight, | ||
| [TextVariant.ButtonLabelLg]: typography.sButtonLabelLg | ||
| .fontWeight as FontWeight, | ||
| [TextVariant.AmountDisplayLg]: typography.sAmountDisplayLg | ||
| .fontWeight as FontWeight, | ||
| [TextVariant.DisplayLg]: FontWeight.Bold, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why replace Previously, |
||
| [TextVariant.DisplayMd]: FontWeight.Bold, | ||
| [TextVariant.HeadingLg]: FontWeight.Bold, | ||
| [TextVariant.HeadingMd]: FontWeight.Bold, | ||
| [TextVariant.HeadingSm]: FontWeight.Bold, | ||
| [TextVariant.BodyLg]: FontWeight.Medium, | ||
| [TextVariant.BodyMd]: FontWeight.Regular, | ||
| [TextVariant.BodySm]: FontWeight.Regular, | ||
| [TextVariant.BodyXs]: FontWeight.Regular, | ||
| [TextVariant.PageHeading]: FontWeight.Bold, | ||
| [TextVariant.SectionHeading]: FontWeight.Bold, | ||
| [TextVariant.ButtonLabelMd]: FontWeight.Medium, | ||
| [TextVariant.ButtonLabelLg]: FontWeight.Medium, | ||
| [TextVariant.AmountDisplayLg]: FontWeight.Bold, | ||
| }; | ||
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.
Why can't you import
TextVariantfrom'../Text'?Both
InputandTextare consumers ofTextVariant— neither owns it. Importing through'../Text'creates a false semantic coupling (implyingInputis built on top ofText), a latent circular-dependency risk (Input → Text → InputifTextever renders anInput), and obscures that the real source is@metamask/design-system-shared. The table here codifies the rule into a quick reference that scales to every shared type, not justTextVariant.