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

Banner component #2939

Closed
eriknson opened this issue Dec 10, 2024 · 0 comments · Fixed by MetaMask/metamask-extension#29271 or MetaMask/metamask-extension#29275
Closed

Banner component #2939

eriknson opened this issue Dec 10, 2024 · 0 comments · Fixed by MetaMask/metamask-extension#29271 or MetaMask/metamask-extension#29275
Assignees
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0

Comments

@eriknson
Copy link
Member

Let's expose the DS BannerAlert as snaps custom UI component.

At first glance, I think all props / variants make sense - but open to hearing an engineering perspective on this

david0xd added a commit to MetaMask/metamask-extension that referenced this issue Dec 17, 2024
## **Description**
Add Snap UI Banner component.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29271?quickstart=1)

## **Related issues**
Fixes: MetaMask/snaps#2939

## **Manual testing steps**
1. Install test Snap from the code example provided and check the
results.

Example Snap code with Banners in the UI:
```typescript
<Container>
  <Box>
    <Banner title="Success banner" severity="success">
      <Text>
        <Icon name="arrow-right" color="primary" size="inherit" />
        &nbsp;Here is the banner content!
      </Text>
      <Bold>Banner bold formatted text</Bold>
      <Italic>Banner italic formatted text</Italic>
      <Text>
        You can click here:&nbsp;
        <Link href="https://snaps.metamask.io/">Banner link</Link>
      </Text>
      <Button type="button">Banner Action Button</Button>
    </Banner>
    <Banner title="Info banner" severity="info">
      <Text>Here is the banner content!</Text>
    </Banner>
    <Banner title="Warning banner" severity="warning">
      <Text>Here is the banner content!</Text>
    </Banner>
    <Banner title="Danger banner" severity="danger">
      <Text>Here is the banner content!</Text>
    </Banner>
  </Box>
</Container>
```

## **Screenshots/Recordings**
### **Before**
Banner in Snap UI was not available before this PR. Nothing to show
here.

### **After**
![Screenshot 2024-12-17 at 12 34
42](https://github.com/user-attachments/assets/bdf291be-b41b-4e0a-964c-218dbd2dae5e)

## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
FrederikBolding pushed a commit to MetaMask/metamask-extension that referenced this issue Dec 20, 2024
Add Snap UI Banner component.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29271?quickstart=1)

Fixes: MetaMask/snaps#2939

1. Install test Snap from the code example provided and check the
results.

Example Snap code with Banners in the UI:
```typescript
<Container>
  <Box>
    <Banner title="Success banner" severity="success">
      <Text>
        <Icon name="arrow-right" color="primary" size="inherit" />
        &nbsp;Here is the banner content!
      </Text>
      <Bold>Banner bold formatted text</Bold>
      <Italic>Banner italic formatted text</Italic>
      <Text>
        You can click here:&nbsp;
        <Link href="https://snaps.metamask.io/">Banner link</Link>
      </Text>
      <Button type="button">Banner Action Button</Button>
    </Banner>
    <Banner title="Info banner" severity="info">
      <Text>Here is the banner content!</Text>
    </Banner>
    <Banner title="Warning banner" severity="warning">
      <Text>Here is the banner content!</Text>
    </Banner>
    <Banner title="Danger banner" severity="danger">
      <Text>Here is the banner content!</Text>
    </Banner>
  </Box>
</Container>
```

Banner in Snap UI was not available before this PR. Nothing to show
here.

![Screenshot 2024-12-17 at 12 34
42](https://github.com/user-attachments/assets/bdf291be-b41b-4e0a-964c-218dbd2dae5e)

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this issue Dec 20, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Bump Snaps packages and handle any required changes.

Summary of Snaps changes:
- Allow async initialization logic for Snap bundles
- Add `onSettingsPage` export
- Add `Banner` component
- Support `size` prop on `Button`
- Support `fontWeight` prop on `Text`
- Add `loading` state for `Button`
- Use BigInt for processing insight chain IDs

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29275?quickstart=1)

## **Related issues**
Closes MetaMask/snaps#2939
Closes MetaMask/snaps#2947
Closes MetaMask/snaps#2874
Closes MetaMask/snaps#2694

---------

Co-authored-by: David Drazic <[email protected]>
Co-authored-by: Guillaume Roux <[email protected]>
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0
Projects
None yet
3 participants