Commit 6069bb0
authored
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:

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:

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,
};
```1 parent 6861362 commit 6069bb0
File tree
6 files changed
+21
-4
lines changed- packages
- examples/packages
- browserify-plugin
- browserify
- snaps-sdk/src/jsx
- components
6 files changed
+21
-4
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
23 | | - | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
759 | 759 | | |
760 | 760 | | |
761 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
762 | 768 | | |
763 | 769 | | |
764 | 770 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
880 | 883 | | |
881 | 884 | | |
882 | 885 | | |
| |||
0 commit comments