feat: migrate ButtonIcon to ADR-0003 and ADR-0004 (DSYS-485)#1038
Draft
cursor[bot] wants to merge 1 commit intomainfrom
Draft
feat: migrate ButtonIcon to ADR-0003 and ADR-0004 (DSYS-485)#1038cursor[bot] wants to merge 1 commit intomainfrom
cursor[bot] wants to merge 1 commit intomainfrom
Conversation
- Create ButtonIconSize and ButtonIconVariant const objects in shared package (ADR-0003) - Create ButtonIconPropsShared type in shared package (ADR-0004) - Update React and React Native ButtonIcon.types.ts to import from shared - Update ButtonIcon index.ts files to re-export const objects from shared - Update ButtonIcon.tsx, constants, stories, and test files to import from shared - Remove old ButtonIconSize and ButtonIconVariant enums from platform types/index.ts - Update BannerBase.tsx in both packages to import ButtonIconSize from shared 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
ButtonIconcomponent to follow ADR-0003 (String Unions) and ADR-0004 (Centralized Types Architecture).Changes:
ButtonIconSizeandButtonIconVariantconst objects in@metamask/design-system-shared(ADR-0003), replacing the duplicate TypeScript enums in both platform packagesButtonIconPropsSharedtype in shared package (ADR-0004) with platform-independent props (iconName: string,size,isDisabled,variant)ButtonIconPropsin both React and React Native to import and extend from shared (platform-specific props likeiconProps: Partial<IconProps>,ariaLabel,className/twClassName, andstyleremain in platform packages)index.tsfiles in both platform packages to re-export const objects from sharedButtonIconSizeandButtonIconVariantenums from platformtypes/index.tsfilesButtonIcon.tsx,ButtonIcon.constants.ts,ButtonIcon.stories.tsx,ButtonIcon.test.tsx,BannerBase.tsx) to import from@metamask/design-system-sharedRelated issues
Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-485
Manual testing steps
yarn build— should complete with no errorsyarn test— all tests pass with 100% coverageyarn lint— no errorsScreenshots/Recordings
Before
Duplicate
ButtonIconSizeandButtonIconVariantenums defined separately in bothdesign-system-react/src/types/index.tsanddesign-system-react-native/src/types/index.ts.After
Single source of truth:
ButtonIconSizeandButtonIconVariantas const objects in@metamask/design-system-shared, withButtonIconPropsSharedcapturing cross-platform props.Pre-merge author checklist
Pre-merge reviewer checklist