From b0c0c353345dd2c9ce2a661ffb2be2afb7355454 Mon Sep 17 00:00:00 2001 From: George Marshall Date: Fri, 13 Oct 2023 06:49:46 -0700 Subject: [PATCH] Fixing truncation and alignment in the network toggle component (#21370) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Currently there is some truncation issues with long network names in the privacy incoming transactions section. The truncation of the text is not working which results in broken UI for longer network names This PR adds some styles which resolve the issue as well as adding a story for the network-toggle component for easier revision and review ## **Manual testing steps** _1. Open the storybook build on this PR _2. Search `NetworkToggle` and check the story in small screen sizes _3. Pull this branch _4. Go to Settings > Security & privacy > Incoming transactions section ## **Screenshots/Recordings** ### **Before** https://github.com/MetaMask/metamask-extension/assets/8112138/9a7028ca-f70a-4833-94db-75e81b791206 ### **After** https://github.com/MetaMask/metamask-extension/assets/8112138/770cb8c7-f8ba-4a40-b941-1115bcbdd83c ## **Related issues** _Fixes #21369_ ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained: - [x] What problem this PR is solving. - [x] How this problem was solved. - [x] How reviewers can test my changes. - [x] I’ve indicated what issue this PR is linked to: Fixes #21369 - [x] I’ve included tests if applicable. - [x] I’ve documented any added code. - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). - [x] I’ve properly set the pull request status: - [x] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **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. --- ui/components/app/app-components.scss | 1 + .../incoming-transaction-toggle.test.js.snap | 492 +++++++++--------- .../network-toggle.scss | 5 + .../network-toggle.stories.tsx | 33 ++ .../network-toggle.tsx | 61 ++- .../__snapshots__/security-tab.test.js.snap | 410 ++++++++------- 6 files changed, 549 insertions(+), 453 deletions(-) create mode 100644 ui/components/app/incoming-trasaction-toggle/network-toggle.scss create mode 100644 ui/components/app/incoming-trasaction-toggle/network-toggle.stories.tsx diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index 24bfd9146013..476901a28f62 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -49,6 +49,7 @@ @import 'multilayer-fee-message/index'; @import 'multiple-notifications/index'; @import 'network-display/index'; +@import 'ui/components/app/incoming-trasaction-toggle/network-toggle'; @import 'permission-page-container/index'; @import 'permissions-connect-footer/index'; @import 'permissions-connect-header/index'; diff --git a/ui/components/app/incoming-trasaction-toggle/__snapshots__/incoming-transaction-toggle.test.js.snap b/ui/components/app/incoming-trasaction-toggle/__snapshots__/incoming-transaction-toggle.test.js.snap index 0113330cccdd..465ba53bbb89 100644 --- a/ui/components/app/incoming-trasaction-toggle/__snapshots__/incoming-transaction-toggle.test.js.snap +++ b/ui/components/app/incoming-trasaction-toggle/__snapshots__/incoming-transaction-toggle.test.js.snap @@ -16,11 +16,11 @@ exports[`IncomingTransactionToggle should render existing incoming transaction p This relies on different third-party APIs for each network, which expose your Ethereum address and your IP address.

Ethereum Mainnet

-
+ style="width: 40px; height: 24px; padding: 0px; border-radius: 26px; display: flex; align-items: center; justify-content: center; background-color: rgb(242, 244, 246);" + > +
+
+
+
+
+
-
+ + Off + + + On +
- -
-
- - Off - - - On - -
- + +
-
+ style="width: 40px; height: 24px; padding: 0px; border-radius: 26px; display: flex; align-items: center; justify-content: center; background-color: rgb(242, 244, 246);" + > +
+
+
+
+
+
-
+ + Off + + + On +
- -
-
- - Off - - - On - -
- + +
-
+ style="width: 40px; height: 24px; padding: 0px; border-radius: 26px; display: flex; align-items: center; justify-content: center; background-color: rgb(242, 244, 246);" + > +
+
+
+
+
+
-
+ + Off + + + On +
- -
-
- - Off - - - On - -
- + +
-
+ style="width: 40px; height: 24px; padding: 0px; border-radius: 26px; display: flex; align-items: center; justify-content: center; background-color: rgb(242, 244, 246);" + > +
+
+
+
+
+
-
+ + Off + + + On +
- -
-
- - Off - - - On - -
- + +
-
+ style="width: 40px; height: 24px; padding: 0px; border-radius: 26px; display: flex; align-items: center; justify-content: center; background-color: rgb(242, 244, 246);" + > +
+
+
+
+
+
-
+ + Off + + + On +
- -
-
- - Off - - - On - -
- + +
-