From 6ba27f8369c6fcdae5fd041c3341ef29d07096ec Mon Sep 17 00:00:00 2001 From: wukko Date: Fri, 27 Sep 2024 20:54:09 +0600 Subject: [PATCH] web/DonateOptionsCard: add scroll buttons to the options container cuz users without touchpads couldn't scroll it without tabbing --- .../donate/DonateOptionsCard.svelte | 175 ++++++++++++++++-- 1 file changed, 159 insertions(+), 16 deletions(-) diff --git a/web/src/components/donate/DonateOptionsCard.svelte b/web/src/components/donate/DonateOptionsCard.svelte index 4a162519..d4557a0f 100644 --- a/web/src/components/donate/DonateOptionsCard.svelte +++ b/web/src/components/donate/DonateOptionsCard.svelte @@ -1,5 +1,8 @@ @@ -84,10 +113,11 @@
+ -
- {#each Object.entries(PRESET_DONATION_AMOUNTS) as [ amount, component ]} - - - - {/each} + + +
{#if customInputValue || customInput?.validity.badInput} $ {/if} + e.key === "Enter" && sendCustom()} />
+
+ @@ -288,6 +358,79 @@ text-align: center; } + #donation-options-container { + display: flex; + flex-direction: column; + gap: calc(var(--donate-card-main-padding) / 2); + position: relative; + } + + #donation-options-scroll { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + position: absolute; + pointer-events: none; + width: 100%; + height: 100%; + z-index: 3; + overflow: hidden; + opacity: 0; + transition: opacity 0.2s; + } + + .scroll-button { + pointer-events: all; + color: white; + padding: 0 16px; + background-color: transparent; + height: 100%; + transition: opacity 0.2s; + } + + #donation-options-container:hover #donation-options-scroll { + opacity: 1; + } + + .scroll-button.hidden { + opacity: 0; + visibility: hidden; + } + + #donation-options-container.mask-both:hover #donation-options { + mask-image: linear-gradient( + 90deg, + rgba(0, 0, 0, 0) 0%, + rgba(0, 0, 0, 1) 20%, + rgba(0, 0, 0, 1) 50%, + rgba(0, 0, 0, 1) 80%, + rgba(0, 0, 0, 0) 100% + ); + } + + #donation-options-container.mask-left:hover #donation-options { + mask-image: linear-gradient( + 90deg, + rgba(0, 0, 0, 0) 0%, + rgba(0, 0, 0, 1) 20%, + rgba(0, 0, 0, 1) 50%, + rgba(0, 0, 0, 1) 96%, + rgba(0, 0, 0, 0) 100% + ); + } + + #donation-options-container.mask-right:hover #donation-options { + mask-image: linear-gradient( + 90deg, + rgba(0, 0, 0, 0) 0%, + rgba(0, 0, 0, 1) 4%, + rgba(0, 0, 0, 1) 50%, + rgba(0, 0, 0, 1) 80%, + rgba(0, 0, 0, 0) 100% + ); + } + @media screen and (max-width: 550px) { :global(#donation-box) { min-width: unset;