Skip to content

Commit 2359406

Browse files
Change the layout of the "Support us" page, to highlight the Spyder project (#65)
1 parent 6feb24f commit 2359406

File tree

10 files changed

+551
-254
lines changed

10 files changed

+551
-254
lines changed

src/lib/blocks/Blog.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script>
2-
import { _, waitLocale, locale } from "svelte-i18n";
2+
import { _, locale, waitLocale } from "svelte-i18n";
33
44
import { browser } from "$app/environment";
55
import { base } from "$app/paths";
66
7-
import { formattedPubDate, fetchAuthorsMetadata } from "$lib/utils";
7+
import { fetchAuthorsMetadata, formattedPubDate } from "$lib/utils";
88
99
import Loader from "$lib/components/Loader.svelte";
1010
import Pagination from "$lib/components/Pagination.svelte";
@@ -62,7 +62,7 @@
6262
font-extralight
6363
text-mine-shaft-600
6464
dark:text-mine-shaft-200
65-
my-16 md:my-32"
65+
my-16 xl:my-32"
6666
>
6767
{$_("config.blog.title")}
6868
</h1>
@@ -71,7 +71,7 @@
7171
{#await postsWithAuthor}
7272
<Loader classes="fill-black dark:fill-white" />
7373
{:then loadedPosts}
74-
<div class="grid grid-flow-row gap-24">
74+
<div class="grid grid-flow-row gap-16 xl:gap-24">
7575
{#each loadedPosts as post}
7676
<article>
7777
<h2

src/lib/blocks/ContributorBlock.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
class="flex flex-col items-center mx-auto {containerSizeClass[size]}"
3131
>
3232
{#if title}
33-
<h2 class="text-4xl text-center text-red-berry-900 dark:text-neutral-400 mt-32 mb-16">
33+
<h2 class="text-3xl xl:text-4xl font-extralight xl:font-light text-center text-red-berry-900 dark:text-neutral-400 my-16 xl:mt-32">
3434
{title}
3535
</h2>
3636
{/if}

src/lib/components/Button.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
unknown: "BsQuestionCircleFill",
3030
windows: "BsWindows",
3131
donate: "BsHeartFill",
32+
more: "BsArrowRightCircleFill",
33+
info: "BsInfoCircleFill"
3234
};
3335
3436
let iconThemes = {
Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,64 @@
11
<script>
22
export let progress = 0;
3+
export let mt = 4;
34
4-
let percentage = 0;
5-
let offset = 0;
5+
let textElement;
6+
let progressContainer;
7+
let marginLeft = 0;
68
79
$: normalizedProgress = Math.min(progress, 100);
8-
$: offset = percentage.offsetWidth / 2;
10+
11+
function calculateMargin() {
12+
if (!textElement || !progressContainer) return 0;
13+
14+
const containerWidth = progressContainer.offsetWidth;
15+
const textWidth = textElement.offsetWidth;
16+
17+
if (containerWidth === 0 || textWidth === 0) return 0;
18+
19+
// Calculate target position (center text on progress end)
20+
const targetPixels = (normalizedProgress / 100) * containerWidth - textWidth / 2;
21+
22+
// Keep within bounds
23+
const minPixels = 0;
24+
const maxPixels = containerWidth - textWidth;
25+
const constrainedPixels = Math.min(Math.max(targetPixels, minPixels), maxPixels);
26+
27+
// Convert to percentage
28+
return (constrainedPixels / containerWidth) * 100;
29+
}
30+
31+
$: {
32+
normalizedProgress;
33+
if (textElement && progressContainer) {
34+
marginLeft = calculateMargin();
35+
}
36+
}
937
</script>
1038

11-
<div class="progress-bar-container relative mt-4">
39+
<div class="progress-bar-container mt-{mt}" bind:this={progressContainer}>
1240
<div class="progress-bar">
1341
<div class="progress" style="width: {normalizedProgress}%" />
1442
</div>
15-
<div
16-
bind:this={percentage}
17-
class="progress-bar-text"
18-
style="left: min(max(calc({normalizedProgress}% - {offset}px), 0px), calc(100% - {percentage?.offsetWidth || 0}px))"
19-
>
43+
<div bind:this={textElement} class="progress-bar-text" style="margin-left: {marginLeft}%">
2044
{normalizedProgress}%
2145
</div>
2246
</div>
2347

2448
<style lang="postcss">
25-
/* dark:bg-mine-shaft-950 dark:text-spring-wood-50 */
26-
.progress-bar {
27-
@apply h-4 w-full overflow-hidden rounded-full bg-mine-shaft-100 dark:bg-mine-shaft-800;
49+
.progress-bar-container {
50+
@apply flex flex-col gap-[2px];
2851
}
2952
30-
.progress-bar-text {
31-
@apply absolute left-0 top-5 text-center text-sm;
53+
.progress-bar {
54+
@apply h-2 w-full overflow-hidden rounded-full bg-mine-shaft-100 dark:bg-mine-shaft-800;
3255
}
3356
3457
.progress {
3558
@apply h-full bg-red-berry-800 transition-all duration-500 dark:bg-red-berry-900;
3659
}
60+
61+
.progress-bar-text {
62+
@apply text-xs text-mine-shaft-600 dark:text-mine-shaft-400 transition-all duration-300 inline-block w-fit;
63+
}
3764
</style>

0 commit comments

Comments
 (0)