-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backgroundColor property to Container component (#2950)
This PR adds `backgroundColor` property to `Container` component. Related task: #2906 Related extension PR: MetaMask/metamask-extension#29095 ### Notes - Background colors that can be used are predefined as: `default` and `alternative`. - Background colors are meant to mirror `backgroundDefault` and `backgroundAlternative` colors from MetaMask extension design system (https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.ts#L54). - Color names are simplified on the Snaps side to make it easier for developers to use. ### Examples (experiments with extension integration) Confirmation example: ![Screenshot 2024-12-11 at 13 14 02](https://github.com/user-attachments/assets/f2b77202-d9c4-403e-87a1-ad36d44299c9) Source code used for content: ```typescript return snap.request({ method: 'snap_dialog', params: { content: ( <Container backgroundColor="default"> <Box> <Text>Testing container background.</Text> <Button variant="primary">Primary button</Button> <Button variant="destructive">Destructive button</Button> <Button disabled={true}>Disabled button</Button> </Box> <Footer> <Button>Accept</Button> <Button name="footer_button">Cancel</Button> </Footer> </Container> ), }, }); ``` Transaction insight example where background color is deliberately ignored: ![Screenshot 2024-12-11 at 13 07 40](https://github.com/user-attachments/assets/b7b3a593-8407-4f92-a629-edd85c8f88dc) Source code used for content: ```typescript return { content: ( <Container backgroundColor="alternative"> <Box> <Text>Testing container background on transaction insight.</Text> <Text>Normal transaction.</Text> </Box> </Container> ), severity: SeverityLevel.Critical, }; ```
- Loading branch information
Showing
6 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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