Skip to content

Commit

Permalink
fix: Use correct prop for Snap UI Avatar size (#29466)
Browse files Browse the repository at this point in the history
<!--
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**

Fixes an issue where the `size` prop would not work for the Snap UI
`Avatar` component. This prop was simply missed in the mapping function,
this PR corrects that.

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

## **Manual testing steps**

```ts
export const onRpcRequest: OnRpcRequestHandler = async ({
  origin,
  request,
}) => {
  switch (request.method) {
    case 'hello':
      return snap.request({
        method: 'snap_dialog',
        params: {
          type: 'confirmation',
          content: (
            <Container>
            <Box>
              <Avatar size='sm' address='bip122:000000000019d6689c085ae165831e93:128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6' />
            </Box>
          </Container>
          ),
        },
      });
    default:
      throw new Error('Method not found.');
  }
};
```
  • Loading branch information
FrederikBolding authored Jan 7, 2025
1 parent 47fdbe4 commit 3c220da
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export const avatar: UIComponentFactory<AvatarElement> = ({ element }) => ({
element: 'SnapUIAvatar',
props: {
address: element.props.address,
size: element.props.size,
},
});

0 comments on commit 3c220da

Please sign in to comment.