From 05f6b7fd39f296939ed39186af0559da139fae00 Mon Sep 17 00:00:00 2001 From: matthieu42morin Date: Sat, 11 Nov 2023 16:34:26 +0100 Subject: [PATCH] gh contributions & main page --- src/lib/types/contributions.d.ts | 10 +++------- src/routes/(home)/+page.svelte | 9 ++------- src/routes/(home)/Scene.svelte | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/lib/types/contributions.d.ts b/src/lib/types/contributions.d.ts index 28a5544..0ae522b 100644 --- a/src/lib/types/contributions.d.ts +++ b/src/lib/types/contributions.d.ts @@ -1,10 +1,6 @@ -type Day = { - count: number; - day: number; +type Contribution = { + date: string; level: number; - month: string; - name: string; - year: number; }; -export type Contributions = Array; +export type Contributions = Array; diff --git a/src/routes/(home)/+page.svelte b/src/routes/(home)/+page.svelte index 897b22b..06ae5a3 100644 --- a/src/routes/(home)/+page.svelte +++ b/src/routes/(home)/+page.svelte @@ -20,11 +20,6 @@ Look at my blog -
-

Try editing the following:

-

foo:bar

-

ligma:ass

-
IconMy github contributions -
+
@@ -53,7 +48,7 @@ animation: pulse 5s cubic-bezier(0, 0, 0, 0.5) infinite, glow 5s linear infinite; } .scene { - @apply relative inset-1 w-[100%vw] h-[150px] md:h-[600px] lg:h-[800px]; + @apply relative inset-1 w-[100%vw] h-[150px] md:h-[400px] lg:h-[600px]; } @keyframes glow { 0% { diff --git a/src/routes/(home)/Scene.svelte b/src/routes/(home)/Scene.svelte index aed217d..f2b049e 100644 --- a/src/routes/(home)/Scene.svelte +++ b/src/routes/(home)/Scene.svelte @@ -17,7 +17,7 @@ const colorMap = ['#0e0e0e', '#00442a', '#006d35', '#00a648', '#00d35c']; // function to normalize the height of the cubes - function normalize(count: number, base = 4, offset = 2) { + function normalize(count: number, base = 4, offset = 6) { switch (true) { case count === 0: return base; @@ -28,7 +28,7 @@ } } - // tweened value to animate the scaleY of the cubes, this should actually be Z, but + // tweened value to animate the Z scale of the cubes const scaleZ = tweened(0, { duration: 2000, easing: quadInOut }); onMount(() => { @@ -37,7 +37,7 @@ - + @@ -48,13 +48,13 @@ {#if Array.isArray(contributions) && contributions.length > 0} {#each contributions as row, i} - {#each row as day, j} - {#if day !== null} - {@const y = normalize(day.level)} - - - - + {#each row as contribution, j} + {#if contribution !== null} + {@const z = normalize(contribution.level)} + + + + {/if}