web/donate: move header to component, initial donation options

This commit is contained in:
dumbmoron 2024-08-04 16:11:21 +00:00
parent e72efae24d
commit 640898e022
No known key found for this signature in database
2 changed files with 227 additions and 99 deletions

View file

@ -0,0 +1,133 @@
<script lang="ts">
import "@fontsource/redaction-10/400.css";
import { t } from "$lib/i18n/translations";
import Meowbalt from "$components/misc/Meowbalt.svelte";
import IconHeart from "@tabler/icons-svelte/IconHeart.svelte";
</script>
<header id="banner">
<div id="banner-contents">
<div id="banner-left">
<img id="imput-logo" src="/icons/imput.svg" alt="imput logo" />
<div id="banner-title" class="redaction">{$t('donate.title')}</div>
<div id="banner-subtitle">{$t('donate.subtitle')}</div>
</div>
<div id="banner-right">
<Meowbalt emotion="fast" />
</div>
</div>
<div id="banner-background">
<div id="banner-background-animation">
<div id="banner-background-inner">
{#each {length: 144} as _}
<IconHeart class="heart-icon" />
{/each}
</div>
</div>
</div>
</header>
<style>
#banner {
position: relative;
border-radius: calc(3 * var(--border-radius));
background: linear-gradient(
190deg,
#1a1a1a 30%,
#3c3c3c 100%
);
}
#banner-contents {
position: relative;
display: flex;
width: 100%;
z-index: 2;
}
#banner-background {
position: absolute;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 10%;
mask-image: linear-gradient(
145deg,
rgba(0,0,0,1) 0%,
rgba(255,255,255,0) 60%
);
}
#banner-background-inner {
color: white;
transform: rotate(-8deg) scale(1.5) translateY(-4em);
}
#banner-background-inner :global(.heart-icon) {
height: 48px;
width: 48px;
stroke-width: 1.5px;
margin: -2.4px;
}
#banner-right :global(.meowbalt) {
height: 40vmin;
margin-top: -32px;
margin-left: -64px;
}
#banner-right {
transform: translate(12px, 48px);
display: flex;
align-items: center;
}
#imput-logo {
width: 48px;
}
#banner-left {
display: flex;
flex-direction: column;
justify-content: center;
padding: 40px 56px;
color: white;
gap: 16px;
white-space: pre-wrap;
}
#banner-title {
font-family: serif;
font-size: 48px;
font-weight: 400;
line-height: 0.95;
}
#banner-title.redaction {
font-family: 'Redaction 10', serif;
font-smooth: never;
-webkit-font-smoothing: none;
}
#banner-subtitle {
color: var(--gray);
}
#banner-background-animation {
animation: heart-move 5s infinite linear;
}
@keyframes heart-move {
from {
transform: translateX(0) translateY(0);
}
to {
transform: translate(74px) translateY(61px);
}
}
</style>

View file

@ -3,9 +3,10 @@
import { t } from "$lib/i18n/translations"; import { t } from "$lib/i18n/translations";
import { donate } from "$lib/env"; import { donate } from "$lib/env";
import DonateBanner from "$components/misc/DonateBanner.svelte";
import IconHeart from "@tabler/icons-svelte/IconHeart.svelte"; import IconCalendarRepeat from "@tabler/icons-svelte/IconCalendarRepeat.svelte";
import Meowbalt from "$components/misc/Meowbalt.svelte"; import IconCup from "@tabler/icons-svelte/IconCup.svelte";
import IconArrowRight from "@tabler/icons-svelte/IconArrowRight.svelte";
let customAmountOnceInput: HTMLInputElement; let customAmountOnceInput: HTMLInputElement;
let customAmountRecurringInput: HTMLInputElement; let customAmountRecurringInput: HTMLInputElement;
@ -34,27 +35,35 @@
</svelte:head> </svelte:head>
<main id="donate-page"> <main id="donate-page">
<header id="banner"> <DonateBanner />
<div id="banner-contents"> <section id="donation-options">
<div id="banner-left"> {#each {length: 2} as _}
<img id="imput-logo" src="/icons/imput.svg" alt="imput logo" /> <!-- TODO: move this whole thing into a component -->
<div id="banner-title">{$t('donate.title')}</div> <div class="donation-box">
<div id="banner-subtitle">{$t('donate.subtitle')}</div> <div class="donation-info">
<div class="donation-icon"><IconCalendarRepeat /></div>
<div class="donation-title">monthly donation</div>
<div class="donation-subtitle">processed by liberapay</div>
</div> </div>
<div id="banner-right"> <div class="donation-scrollbox">
<Meowbalt emotion="fast" /> {#each {length: 4} as _}
<!-- TODO: maybe move this also into a component -->
<button class="donation-option">
<div class="donation-amount"><IconCup /> $5</div>
<div class="donation-subtitle">cup of coffee</div>
</button>
{/each}
</div>
<div class="donation-custom">
<input type="number" placeholder="custom amount (from $2)">
<button><IconArrowRight /></button>
</div>
<div class="donation-footer donation-subtitle">
you will be redirected to liberapay
</div> </div>
</div> </div>
<div id="banner-background"> {/each}
<div id="banner-background-animation"> </section>
<div id="banner-background-inner">
{#each {length: 144} as _}
<IconHeart class="heart-icon" />
{/each}
</div>
</div>
</div>
</header>
</main> </main>
<style> <style>
@ -65,96 +74,82 @@
padding: var(--padding); padding: var(--padding);
} }
#banner { #donation-options {
position: relative;
border-radius: calc(3 * var(--border-radius));
background: linear-gradient(
190deg,
#1a1a1a 30%,
#3c3c3c 100%
);
}
#banner-contents {
position: relative;
display: flex; display: flex;
width: 100%; justify-content: space-evenly;
z-index: 2; padding-top: 16px;
} }
#banner-background { .donation-box {
position: absolute;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 10%;
mask-image: linear-gradient(
145deg,
rgba(0,0,0,1) 0%,
rgba(255,255,255,0) 60%
);
}
#banner-background-inner {
color: white;
transform: rotate(-8deg) scale(1.5) translateY(-4em);
}
#banner-background-inner :global(.heart-icon) {
height: 3em;
width: 3em;
stroke-width: 1.5px;
margin: -.15em;
}
#banner-right :global(.meowbalt) {
height: 40vmin;
margin-top: -2em;
margin-left: -4em;
}
#banner-right {
transform: translate(12px, 48px);
display: flex;
align-items: center;
}
#imput-logo {
width: 3em;
}
#banner-left {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; border-radius: calc(3 * var(--border-radius));
padding: 2.5em 3.5em; padding: 32px;
background: linear-gradient(
rgba(65,65,65,1) 5%,
rgba(26,26,26,1)
);
color: white; color: white;
gap: 1em; gap: 8px;
white-space: pre-wrap;
} }
#banner-title { .donation-icon :global(*) {
font-family: 'Redaction 10', serif; width: 28px;
font-size: 3em; height: 28px;
font-weight: 400;
line-height: 0.95;
} }
#banner-subtitle { .donation-title {
color: var(--gray); font-size: 14.5px;
}
#banner-background-animation {
animation: heart-move 5s infinite linear;
} }
@keyframes heart-move { .donation-subtitle {
from { font-size: 12px;
transform: translateX(0) translateY(0); color: #9a9a9a;
} }
to { .donation-scrollbox {
transform: translate(74px) translateY(61px); display: flex;
} overflow-x: scroll;
width: 384px;
gap: 5px;
}
.donation-option {
display: flex;
flex-direction: column;
background: #3b3b3b;
color: white;
align-items: start;
padding: 15px;
border-radius: var(--border-radius);
width: 128px;
}
.donation-amount {
display: flex;
align-items: center;
gap: 5px;
}
.donation-custom {
display: flex;
gap: 4px;
}
.donation-custom * {
border-radius: var(--border-radius);
border: none;
background-color: #3b3b3b;
color: white;
}
.donation-custom input {
flex: 1;
padding-left: 12px;
}
.donation-footer {
text-align: center;
} }
</style> </style>