Skip to content

feat(shared): migrate Button and ButtonBase to ADR-0003 and ADR-0004 shared types (DSYS-483)#1034

Draft
cursor[bot] wants to merge 2 commits intomainfrom
cursor/enum-shared-type-migration-341b
Draft

feat(shared): migrate Button and ButtonBase to ADR-0003 and ADR-0004 shared types (DSYS-483)#1034
cursor[bot] wants to merge 2 commits intomainfrom
cursor/enum-shared-type-migration-341b

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 2, 2026

Description

Migrates Button and ButtonBase components to follow ADR-0003 (String Unions) and ADR-0004 (Centralized Types Architecture) as part of the DSYS-468 epic.

What changed:

  • Created ButtonBaseSize const object (ADR-0003) and ButtonBasePropsShared type (ADR-0004) in @metamask/design-system-shared
  • Created ButtonVariant const object (ADR-0003) and ButtonPropsShared type (ADR-0004) in @metamask/design-system-shared
  • Removed old ButtonBaseSize, ButtonVariant enums and their aliases (ButtonPrimarySize, ButtonSecondarySize, ButtonTertiarySize, ButtonHeroSize, ButtonSize) from both platform src/types/index.ts files
  • Updated ButtonBase and Button components in both React and React Native packages to import from shared
  • Updated all variant index files to re-export size aliases from shared
  • Updated all downstream files (components, tests, stories) that imported these enums directly from ../../types or ../../../../types

ADR compliance:

  • ADR-0003: ButtonBaseSize and ButtonVariant are now as const objects with derived union types
  • ADR-0004: ButtonBasePropsShared and ButtonPropsShared are now centralized in @metamask/design-system-shared

Verification:

  • yarn workspace @metamask/design-system-shared run build
  • yarn workspace @metamask/design-system-react run build
  • yarn workspace @metamask/design-system-react run test ✅ (100% coverage)
  • yarn workspace @metamask/design-system-react-native run test ✅ (100% coverage)

Related issues

Fixes: DSYS-483

Manual testing steps

  1. Import ButtonBaseSize, ButtonVariant from @metamask/design-system-shared — verify const object values are correct
  2. Import ButtonSize, ButtonVariant from @metamask/design-system-react — verify these still work
  3. Import ButtonBaseSize, ButtonVariant from @metamask/design-system-react-native — verify these still work

Screenshots/Recordings

Before

Enums defined separately in both platform packages' src/types/index.ts.

After

Const objects defined once in @metamask/design-system-shared, re-exported from platform packages for backwards compatibility.

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 

cursoragent and others added 2 commits April 2, 2026 16:28
…shared types (DSYS-483)

Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
…iles

Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 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