-
-
Notifications
You must be signed in to change notification settings - Fork 8
feat(shared): migrate Box to ADR-0003 and ADR-0004 shared types (DSYS-482) #1026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cursor
wants to merge
1
commit into
main
Choose a base branch
from
cursor/enum-shared-type-migration-8196
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 4 additions & 5 deletions
9
packages/design-system-react-native/src/components/BannerAlert/BannerAlert.constants.ts
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
3 changes: 2 additions & 1 deletion
3
packages/design-system-react-native/src/components/BannerAlert/BannerAlert.test.tsx
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
8 changes: 5 additions & 3 deletions
8
packages/design-system-react-native/src/components/BannerBase/BannerBase.tsx
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
5 changes: 4 additions & 1 deletion
5
packages/design-system-react-native/src/components/Box/Box.constants.ts
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
12 changes: 6 additions & 6 deletions
12
packages/design-system-react-native/src/components/Box/Box.stories.tsx
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
15 changes: 7 additions & 8 deletions
15
packages/design-system-react-native/src/components/Box/Box.test.tsx
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
129 changes: 8 additions & 121 deletions
129
packages/design-system-react-native/src/components/Box/Box.types.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,123 +1,10 @@ | ||
| import type { BoxPropsShared } from '@metamask/design-system-shared'; | ||
| import type { ViewProps } from 'react-native'; | ||
|
|
||
| import type { | ||
| BoxFlexDirection, | ||
| BoxFlexWrap, | ||
| BoxSpacing, | ||
| BoxBorderWidth, | ||
| BoxAlignItems, | ||
| BoxJustifyContent, | ||
| BoxBackgroundColor, | ||
| BoxBorderColor, | ||
| } from '../../types'; | ||
|
|
||
| export type BoxProps = { | ||
| /** | ||
| * The flexDirection style of the component. | ||
| */ | ||
| flexDirection?: BoxFlexDirection; | ||
| /** | ||
| * The flexWrap style of the component. | ||
| */ | ||
| flexWrap?: BoxFlexWrap; | ||
| /** | ||
| * The gap between the component's children. | ||
| * Use 1-12 for a gap of 4px-48px. | ||
| */ | ||
| gap?: BoxSpacing; | ||
| /** | ||
| * The alignItems style of the component. | ||
| */ | ||
| alignItems?: BoxAlignItems; | ||
| /** | ||
| * The justifyContent style of the component. | ||
| */ | ||
| justifyContent?: BoxJustifyContent; | ||
| /** | ||
| * The margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| margin?: BoxSpacing; | ||
| /** | ||
| * The top margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| marginTop?: BoxSpacing; | ||
| /** | ||
| * The right margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| marginRight?: BoxSpacing; | ||
| /** | ||
| * The bottom margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| marginBottom?: BoxSpacing; | ||
| /** | ||
| * The left margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| marginLeft?: BoxSpacing; | ||
| /** | ||
| * The horizontal margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| marginHorizontal?: BoxSpacing; | ||
| /** | ||
| * The vertical margin of the component. | ||
| * Use 1-12 for margin of 4px-48px. | ||
| */ | ||
| marginVertical?: BoxSpacing; | ||
| /** | ||
| * The padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| padding?: BoxSpacing; | ||
| /** | ||
| * The top padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| paddingTop?: BoxSpacing; | ||
| /** | ||
| * The right padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| paddingRight?: BoxSpacing; | ||
| /** | ||
| * The bottom padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| paddingBottom?: BoxSpacing; | ||
| /** | ||
| * The left padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| paddingLeft?: BoxSpacing; | ||
| /** | ||
| * The horizontal padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| paddingHorizontal?: BoxSpacing; | ||
| /** | ||
| * The vertical padding of the component. | ||
| * Use 1-12 for padding of 4px-48px. | ||
| */ | ||
| paddingVertical?: BoxSpacing; | ||
| /** | ||
| * The border width of the component. | ||
| * Use 0, 1, 2, 4, or 8 for border width of 0px, 1px, 2px, 4px, or 8px. | ||
| */ | ||
| borderWidth?: BoxBorderWidth; | ||
| /** | ||
| * The border color of the component. | ||
| */ | ||
| borderColor?: BoxBorderColor; | ||
| /** | ||
| * The background color of the component. | ||
| */ | ||
| backgroundColor?: BoxBackgroundColor; | ||
| /** | ||
| * Optional prop to add twrnc overriding classNames. | ||
| */ | ||
| twClassName?: string; | ||
| } & ViewProps; | ||
| export type BoxProps = BoxPropsShared & | ||
| ViewProps & { | ||
| /** | ||
| * Optional prop to add twrnc overriding classNames. | ||
| */ | ||
| twClassName?: string; | ||
| }; |
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
5 changes: 4 additions & 1 deletion
5
packages/design-system-react-native/src/components/BoxHorizontal/BoxHorizontal.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/design-system-react-native/src/components/BoxVertical/BoxVertical.tsx
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
3 changes: 2 additions & 1 deletion
3
packages/design-system-react-native/src/components/ButtonBase/ButtonBase.stories.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/design-system-react-native/src/components/Card/Card.stories.tsx
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
2 changes: 1 addition & 1 deletion
2
...s/design-system-react-native/src/components/MainActionButton/MainActionButton.stories.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/design-system-react-native/src/components/TabEmptyState/TabEmptyState.stories.tsx
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
12 changes: 5 additions & 7 deletions
12
...s/design-system-react-native/src/components/temp-components/Blockies/Blockies.stories.tsx
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
12 changes: 5 additions & 7 deletions
12
...s/design-system-react-native/src/components/temp-components/Jazzicon/Jazzicon.stories.tsx
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
12 changes: 5 additions & 7 deletions
12
...s/design-system-react-native/src/components/temp-components/Maskicon/Maskicon.stories.tsx
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This split-import pattern is the correct ADR-0004 boundary in practice.
BannerAlertSeverity,BoxBackgroundColor, andBoxBorderColorare cross-platform design system tokens → imported from@metamask/design-system-shared.IconColorandIconNameare still platform-specific (React Native Icon enum values differ from React) → stay in../../types. This file is a good example of where the shared/platform boundary sits for a real consuming component.