From 48eaae8d72299a5a4958dd3f0b31e76bca1ef140 Mon Sep 17 00:00:00 2001 From: VDawg Date: Thu, 7 Aug 2025 22:51:21 +0200 Subject: [PATCH] improve sponsor slice (#110) --- src/content/sponsors.json | 7 +- src/lib/components/Sponsor.svelte | 24 +++- src/lib/components/SponsorsSlice.svelte | 70 ---------- src/lib/components/Title/TitleHeading.svelte | 12 +- src/routes/+page.svelte | 2 + src/routes/api/sponsors/+server.ts | 3 +- src/routes/home-slices/SponsorsSlice.svelte | 134 +++++++++++++++++-- 7 files changed, 161 insertions(+), 91 deletions(-) delete mode 100644 src/lib/components/SponsorsSlice.svelte diff --git a/src/content/sponsors.json b/src/content/sponsors.json index a00f9bf..ad2c2b9 100644 --- a/src/content/sponsors.json +++ b/src/content/sponsors.json @@ -1,4 +1,5 @@ { + "diamond": [], "platinum": [ { "name": "37signals", @@ -8,10 +9,8 @@ } ], - "gold": [ - ], + "gold": [], "silver": [], - "bronze": [ - ] + "bronze": [] } diff --git a/src/lib/components/Sponsor.svelte b/src/lib/components/Sponsor.svelte index ad337f2..eff3b3e 100644 --- a/src/lib/components/Sponsor.svelte +++ b/src/lib/components/Sponsor.svelte @@ -6,30 +6,40 @@ export let sponsor: Sponsor export let showImage = false export let showSlogan = false - export let size = 1 + export let sloganClass = '' - + {#if showImage && sponsor.image} {:else}
{sponsor.name}
{/if} + {#if showSlogan && sponsor.slogan} -
+
{sponsor.slogan}
{/if} diff --git a/src/lib/components/SponsorsSlice.svelte b/src/lib/components/SponsorsSlice.svelte deleted file mode 100644 index a2de6c5..0000000 --- a/src/lib/components/SponsorsSlice.svelte +++ /dev/null @@ -1,70 +0,0 @@ - - -
-
- {#if sponsors.platinum.length > 0} -
-

- Platinum -

-
- {#each sponsors.platinum as sponsor} - - {/each} -
-
- {/if} - - {#if sponsors.gold.length > 0} -
-

- Gold -

-
- {#each sponsors.gold as sponsor} - - {/each} -
-
- {/if} - -
- {#if sponsors.silver.length > 0} -
-

Silver

- -
- {#each sponsors.silver as sponsor} - - {/each} -
-
- {/if} - - {#if sponsors.bronze.length > 0} -
-

Bronze

- -
- {#each sponsors.bronze as sponsor} - - {/each} -
-
- {/if} -
-
-
- -
-
diff --git a/src/lib/components/Title/TitleHeading.svelte b/src/lib/components/Title/TitleHeading.svelte index 469a82e..fd53744 100755 --- a/src/lib/components/Title/TitleHeading.svelte +++ b/src/lib/components/Title/TitleHeading.svelte @@ -1,3 +1,13 @@ -

+ + +

No title given!!!

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 9d8e06f..4ca3720 100755 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -31,6 +31,8 @@ + + diff --git a/src/routes/api/sponsors/+server.ts b/src/routes/api/sponsors/+server.ts index cca1338..5dc05bc 100644 --- a/src/routes/api/sponsors/+server.ts +++ b/src/routes/api/sponsors/+server.ts @@ -10,8 +10,9 @@ export type Sponsor = { export type SponsorsRanked = Readonly<{ /** The month for the top donators in `monthTop` */ - month: String + month: string monthTop: readonly Sponsor[] + diamond: readonly Sponsor[] platinum: readonly Sponsor[] gold: readonly Sponsor[] silver: readonly Sponsor[] diff --git a/src/routes/home-slices/SponsorsSlice.svelte b/src/routes/home-slices/SponsorsSlice.svelte index 9b34435..06fdda1 100644 --- a/src/routes/home-slices/SponsorsSlice.svelte +++ b/src/routes/home-slices/SponsorsSlice.svelte @@ -1,17 +1,135 @@ -
- - <TitlePre slot="pre">And a huge thank you!</TitlePre> - <h2 slot="title" class="text-2xl font-bold md:text-3xl">Our sponsors</h2> - +{#if hasSponsors} +
+ - -
+
+ + <TitlePre slot="pre">And a huge thank you!</TitlePre> + <TitleHeading size="small" slot="title">Our sponsors</TitleHeading> + + +
+
+ {#if sponsors.diamond.length > 0} +
+

+ Diamond +

+
+ {#each sponsors.diamond as sponsor} + + {/each} +
+
+ {/if} + + {#if sponsors.platinum.length > 0} +
+

+ Platinum +

+
+ {#each sponsors.platinum as sponsor} + + {/each} +
+
+ {/if} + + {#if sponsors.gold.length > 0} +
+

+ Gold +

+
+ {#each sponsors.gold as sponsor} + + {/each} +
+
+ {/if} + +
+ {#if sponsors.silver.length > 0} +
+

Silver

+ +
+ {#each sponsors.silver as sponsor} + + {/each} +
+
+ {/if} + + {#if sponsors.bronze.length > 0} +
+

Bronze

+ +
+ {#each sponsors.bronze as sponsor} + + {/each} +
+
+ {/if} +
+
+ +
+ +
+
+
+
+{:else} +
+

We currently have no sponsors :(

+

Are you interested or know one person who might be?

+ Hit us up :) + +
+{/if}