feat(DSYS-490): migrate TextButton to ADR-0003 and ADR-0004#1055
Draft
cursor[bot] wants to merge 1 commit intomainfrom
Draft
feat(DSYS-490): migrate TextButton to ADR-0003 and ADR-0004#1055cursor[bot] wants to merge 1 commit intomainfrom
cursor[bot] wants to merge 1 commit intomainfrom
Conversation
- Create TextButtonSize const object in design-system-shared (ADR-0003) - Create TextButtonPropsShared with children and isDisabled in shared (ADR-0004) - Export from design-system-shared/src/index.ts - Remove TextButtonSize enum from React types/index.ts - Update React TextButton: index.ts, types.ts, tsx, constants.ts, stories, test to import from shared - Update React Native TextButton: types.ts extends TextButtonPropsShared, index.ts exports TextButtonSize from shared - Add TextButtonSize to React Native components/index.ts exports Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
Contributor
📖 Storybook Preview |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates the
TextButtoncomponent to follow ADR-0003 (String Unions) and ADR-0004 (Centralized Types Architecture) patterns.Changes:
ADR-0003 (
TextButtonSizeconst object): Converts theTextButtonSizeenum fromdesign-system-react/src/types/index.tsinto aconstobject indesign-system-shared. Values (body-lg,body-md,body-sm,body-xs) remain identical.ADR-0004 (
TextButtonPropsShared): Creates a shared props type indesign-system-sharedwith cross-platform properties (children: ReactNode,isDisabled?: boolean).Files changed:
packages/design-system-shared/src/types/TextButton/TextButton.types.ts— newTextButtonSizeconst +TextButtonPropsSharedtypepackages/design-system-shared/src/types/TextButton/index.ts— new barrel exportpackages/design-system-shared/src/index.ts— exportsTextButtonSizeandTextButtonPropsSharedpackages/design-system-react/src/types/index.ts— removes oldTextButtonSizeenumpackages/design-system-react/src/components/TextButton/*— updates all files to import from@metamask/design-system-sharedpackages/design-system-react-native/src/components/TextButton/*— types extendTextButtonPropsShared, index exportsTextButtonSizepackages/design-system-react-native/src/components/index.ts— addsTextButtonSizeto exportsRelated issues
Fixes: DSYS-490
Part of epic: DSYS-468 — Component ADR Migration
Manual testing steps
TextButtonSizefrom@metamask/design-system-react— verify it still worksTextButtonSizefrom@metamask/design-system-react-native— verify it now exportsTextButtonSizeandTextButtonPropsSharedfrom@metamask/design-system-shared— verify both export<TextButton size={TextButtonSize.BodyMd}>in React — verify no TypeScript errorsScreenshots/Recordings
Before
TextButtonSizewas an enum indesign-system-react/src/types/index.ts, not available in shared or React Native.After
TextButtonSizeis a const object indesign-system-shared, exported from all three packages.TextButtonPropsSharedprovides cross-platform shared props.Pre-merge author checklist
Pre-merge reviewer checklist