chore: migrate Icon to ADR-0003 and ADR-0004 (DSYS-487)#1042
Draft
cursor[bot] wants to merge 1 commit intomainfrom
Draft
chore: migrate Icon to ADR-0003 and ADR-0004 (DSYS-487)#1042cursor[bot] wants to merge 1 commit intomainfrom
cursor[bot] wants to merge 1 commit intomainfrom
Conversation
- Create shared Icon types in packages/design-system-shared/src/types/Icon/ - IconColor: shared const object (common colors across both platforms) - IconName: shared const object (common icons; React extends with PopUp/SidePanel) - IconPropsShared: shared props type (name: string, color?: string; size excluded as platform-specific) - Export Icon shared types from packages/design-system-shared/src/index.ts - React package: convert IconSize/IconName enums to const objects, re-export IconColor from shared, extend IconName with PopUp and SidePanel - React Native package: convert IconColor/IconSize enums to const objects, re-export IconName directly from shared - Update Icon.types.ts in both packages to extend IconPropsShared - Update Icon/index.ts in both packages to export from shared where applicable 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
Iconcomponent to follow ADR-0003 (String Unions) and ADR-0004 (Centralized Types Architecture) as part of the DSYS-468 Component ADR Migration epic.Changes
Shared package (
@metamask/design-system-shared):packages/design-system-shared/src/types/Icon/Icon.types.tswith:IconColor— const object for the common set of icon colors (14 entries shared by both platforms)IconName— const object for the common set of icon names (all icons present in both React and React Native)IconPropsShared— shared props type withname: stringandcolor?: string;sizeis intentionally excluded as values differ between platformspackages/design-system-shared/src/index.tsReact package (
@metamask/design-system-react):IconSizeenum →constobject (React-specific values:'xs'/'sm'/'md'/'lg'/'xl')IconColorenum with re-export from sharedIconNameenum with React-extended const object (spreads sharedIconNameand addsPopUpandSidePanelwhich only exist in the React package)Icon.types.tsto extendIconPropsSharedIcon/index.tsto export from../../typesReact Native package (
@metamask/design-system-react-native):IconColorenum →constobject (RN has 6 extra colors beyond the shared set)IconSizeenum →constobject (RN-specific values:'12'/'16'/'20'/'24'/'32')IconNameenum with re-export from sharedIcon.types.tsto extendIconPropsSharedIcon/index.tsto export from../../typesPlatform differences handled
IconNamePopUp+SidePanelIconColorIconSizeRelated issues
Fixes: DSYS-487
Manual testing steps
yarn buildyarn testyarn storybookIconName,IconColor,IconSizecan still be imported from both@metamask/design-system-reactand@metamask/design-system-react-nativeIconColorandIconNamecan be imported from@metamask/design-system-sharedScreenshots/Recordings
Before
No visual changes — this is a pure internal refactor.
After
No visual changes — this is a pure internal refactor.
Pre-merge author checklist
Pre-merge reviewer checklist