Skip to content
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

Add backgroundColor property to Container component #2950

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

david0xd
Copy link
Contributor

@david0xd david0xd commented Dec 11, 2024

This PR adds backgroundColor property to Container component.

Related task: #2906
Related extension PR: MetaMask/metamask-extension#29095

Notes

Examples (experiments with extension integration)

Confirmation example:
Screenshot 2024-12-11 at 13 14 02

Source code used for content:

      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
Source code used for content:

    return {
      content: (
        <Container backgroundColor="alternative">
          <Box>
            <Text>Testing container background on transaction insight.</Text>
            <Text>Normal transaction.</Text>
          </Box>
        </Container>
      ),
      severity: SeverityLevel.Critical,
    };

@david0xd david0xd self-assigned this Dec 11, 2024
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.49%. Comparing base (51ab913) to head (f3306bf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2950   +/-   ##
=======================================
  Coverage   94.49%   94.49%           
=======================================
  Files         487      487           
  Lines       10451    10451           
  Branches     1604     1604           
=======================================
  Hits         9876     9876           
  Misses        575      575           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@david0xd david0xd force-pushed the dd/ui-container-background branch from eecfa9d to f3306bf Compare December 11, 2024 13:18
@david0xd david0xd marked this pull request as ready for review December 11, 2024 13:37
@david0xd david0xd requested a review from a team as a code owner December 11, 2024 13:37
@@ -21,6 +22,7 @@ export type BoxProps = {
| 'space-around'
| undefined;
center?: boolean | undefined;
backgroundColor?: string | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to only allow it on the Container instead of the Box? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants