From f57a80a83e6482877d2191e732528a8b0664abce Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Wed, 19 Feb 2025 10:40:11 +0100 Subject: [PATCH] feat(snaps): Add `crossAlignment` to `Box` (#30400) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR adds the `crossAlignment` prop to the Snap UI `Box` component. It generates a `align-items` property. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30400?quickstart=1) ## **Related issues** Fixes: #30368 ## **Manual testing steps** ## **Screenshots/Recordings** ## **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. --- .../snap-ui-renderer.test.js.snap | 26 +++++++++---------- .../snaps/snap-ui-renderer/components/box.ts | 26 ++++++++++++++++++- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/ui/components/app/snaps/snap-ui-renderer/__snapshots__/snap-ui-renderer.test.js.snap b/ui/components/app/snaps/snap-ui-renderer/__snapshots__/snap-ui-renderer.test.js.snap index 42d019e2a1f0..1a5d0c9051fb 100644 --- a/ui/components/app/snaps/snap-ui-renderer/__snapshots__/snap-ui-renderer.test.js.snap +++ b/ui/components/app/snaps/snap-ui-renderer/__snapshots__/snap-ui-renderer.test.js.snap @@ -10,7 +10,7 @@ exports[`SnapUIRenderer prefills interactive inputs with existing state 1`] = ` class="box snap-ui-renderer__container box--display-flex box--flex-direction-column" >

= ({ element, ...params @@ -46,7 +67,10 @@ export const box: UIComponentFactory = ({ ? FlexDirection.Row : FlexDirection.Column, justifyContent: generateJustifyContent(element.props.alignment), - alignItems: element.props.center && AlignItems.center, + alignItems: generateAlignItems( + element.props.crossAlignment, + element.props.center, + ), className: 'snap-ui-renderer__panel', color: TextColor.textDefault, },