From 536a6f0877d0f92ca073ca9c227f00a74937080d Mon Sep 17 00:00:00 2001 From: Andrea Scartabelli Date: Tue, 26 Nov 2024 10:47:13 +0100 Subject: [PATCH] web-wallet: fix balance overflowing on small screens Resolves #2994 --- web-wallet/CHANGELOG.md | 4 +- .../src/lib/components/Balance/Balance.css | 59 ++++++++ .../src/lib/components/Balance/Balance.svelte | 37 +---- .../__snapshots__/Balance.spec.js.snap | 112 +++++++------- .../__snapshots__/layout.spec.js.snap | 140 +++++++++--------- .../src/style/dusk-components/balance.css | 44 ------ web-wallet/src/style/main.css | 1 - 7 files changed, 194 insertions(+), 203 deletions(-) create mode 100644 web-wallet/src/lib/components/Balance/Balance.css delete mode 100644 web-wallet/src/style/dusk-components/balance.css diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index b6ac1a99df..73df963c8f 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix auto-sync not working after restoring a wallet [#3042] - Fix application crash on empty amount (Stake Flow) [#3036] - Fix incorrect fee deduction and negative UI display (Allocate flow) [#3056] +- Fix button hover style in Dashboard Navigation Menu [#2999] +- Fix balance overflowing on small screens [#2994] ## [0.8.0] - 2024-11-19 @@ -48,7 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Enhance Allocate flow on full amount allocation [#2938] - Broken link in the stake warning [#2990] - Change "Transaction created" copy [#2991] -- Fix button hover style in Dashboard Navigation Menu [#2999] - Fix Dashboard navigation menu padding [#3000] ## [0.7.0] - 2024-11-11 @@ -368,6 +369,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#2938]: https://github.com/dusk-network/rusk/issues/2938 [#2990]: https://github.com/dusk-network/rusk/issues/2990 [#2991]: https://github.com/dusk-network/rusk/issues/2991 +[#2994]: https://github.com/dusk-network/rusk/issues/2994 [#2997]: https://github.com/dusk-network/rusk/issues/2997 [#2999]: https://github.com/dusk-network/rusk/issues/2999 [#3000]: https://github.com/dusk-network/rusk/issues/3000 diff --git a/web-wallet/src/lib/components/Balance/Balance.css b/web-wallet/src/lib/components/Balance/Balance.css new file mode 100644 index 0000000000..e69d490f63 --- /dev/null +++ b/web-wallet/src/lib/components/Balance/Balance.css @@ -0,0 +1,59 @@ +.dusk-balance { + display: flex; + flex-direction: column; + text-align: center; + width: 100%; + font-size: 1.25rem; + font-weight: 500; + line-height: 1.875rem; +} + +.dusk-balance__account { + display: flex; + justify-content: space-between; + background-color: var(--background-color); + padding: 0.78125rem 0.9375rem; + border-radius: 1.5rem; + flex-wrap: wrap; +} + +.dusk-balance__dusk { + display: flex; + align-items: center; + gap: 0.625rem; + justify-content: center; + font-size: clamp(1rem, 4.5dvw, 2.1875rem); + font-weight: 500; + line-height: 120%; + letter-spacing: -0.0175rem; + max-width: 100%; + white-space: nowrap; + overflow: hidden; +} + +.dusk-balance__fiat { + margin-bottom: 1.25rem; + font-size: 1.25rem; + font-weight: 400; + line-height: 150%; + letter-spacing: -0.01rem; + visibility: hidden; + color: var(--muted-color); +} + +.dusk-balance__fiat--visible { + visibility: unset; +} + +.dusk-balance__value { + font-size: clamp(1rem, 4.5dvw, 1.25rem); + justify-content: end; +} + +.dusk-balance__percentage, +.dusk-balance__value { + display: flex; + gap: 0.625rem; + align-items: center; + flex: 1; +} diff --git a/web-wallet/src/lib/components/Balance/Balance.svelte b/web-wallet/src/lib/components/Balance/Balance.svelte index 92349b60a6..4d60d374c4 100644 --- a/web-wallet/src/lib/components/Balance/Balance.svelte +++ b/web-wallet/src/lib/components/Balance/Balance.svelte @@ -8,6 +8,8 @@ import { logo } from "$lib/dusk/icons"; import { createNumberFormatter } from "$lib/dusk/number"; + import "./Balance.css"; + /** @type {string | undefined} */ export let className = undefined; @@ -54,16 +56,16 @@

Your Balance:

- {duskFormatter(totalBalance)} - {tokenCurrency} + {duskFormatter(totalBalance)} + {tokenCurrency}

- + {fiatFormatter(fiatPrice ? fiatPrice * totalBalance : 0)} - +

@@ -101,30 +103,3 @@ - - diff --git a/web-wallet/src/lib/components/__tests__/__snapshots__/Balance.spec.js.snap b/web-wallet/src/lib/components/__tests__/__snapshots__/Balance.spec.js.snap index 33dc17263b..d1621be11d 100644 --- a/web-wallet/src/lib/components/__tests__/__snapshots__/Balance.spec.js.snap +++ b/web-wallet/src/lib/components/__tests__/__snapshots__/Balance.spec.js.snap @@ -2,7 +2,7 @@ exports[`Balance > renders the Balance component 1`] = `
renders the Balance component 1`] = `

- + 0.003000000 - + - + DUSK - +

- + $0.03 - +

renders the Balance component 1`] = ` class="dusk-card__body-container" >