Skip to content

feat(DSYS-490): migrate TextButton to ADR-0003 and ADR-0004#1055

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/enum-shared-type-migration-4b9d
Draft

feat(DSYS-490): migrate TextButton to ADR-0003 and ADR-0004#1055
cursor[bot] wants to merge 1 commit intomainfrom
cursor/enum-shared-type-migration-4b9d

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 8, 2026

Description

Migrates the TextButton component to follow ADR-0003 (String Unions) and ADR-0004 (Centralized Types Architecture) patterns.

Changes:

  1. ADR-0003 (TextButtonSize const object): Converts the TextButtonSize enum from design-system-react/src/types/index.ts into a const object in design-system-shared. Values (body-lg, body-md, body-sm, body-xs) remain identical.

  2. ADR-0004 (TextButtonPropsShared): Creates a shared props type in design-system-shared with cross-platform properties (children: ReactNode, isDisabled?: boolean).

Files changed:

  • packages/design-system-shared/src/types/TextButton/TextButton.types.ts — new TextButtonSize const + TextButtonPropsShared type
  • packages/design-system-shared/src/types/TextButton/index.ts — new barrel export
  • packages/design-system-shared/src/index.ts — exports TextButtonSize and TextButtonPropsShared
  • packages/design-system-react/src/types/index.ts — removes old TextButtonSize enum
  • packages/design-system-react/src/components/TextButton/* — updates all files to import from @metamask/design-system-shared
  • packages/design-system-react-native/src/components/TextButton/* — types extend TextButtonPropsShared, index exports TextButtonSize
  • packages/design-system-react-native/src/components/index.ts — adds TextButtonSize to exports

Related issues

Fixes: DSYS-490
Part of epic: DSYS-468 — Component ADR Migration

Manual testing steps

  1. Import TextButtonSize from @metamask/design-system-react — verify it still works
  2. Import TextButtonSize from @metamask/design-system-react-native — verify it now exports
  3. Import TextButtonSize and TextButtonPropsShared from @metamask/design-system-shared — verify both export
  4. Use <TextButton size={TextButtonSize.BodyMd}> in React — verify no TypeScript errors

Screenshots/Recordings

Before

TextButtonSize was an enum in design-system-react/src/types/index.ts, not available in shared or React Native.

After

TextButtonSize is a const object in design-system-shared, exported from all three packages. TextButtonPropsShared provides cross-platform shared props.

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Open in Web View Automation 

- 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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

📖 Storybook Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant