From 943f36f76fbf6610e33e0f525947f3feaa502601 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:09:08 +0800 Subject: [PATCH] added Card component --- frontend/src/components/Card.svelte | 71 +++++++++++++++++++++++++++++ frontend/src/routes/MediaKit.svelte | 71 +++++++++++++++++++---------- 2 files changed, 118 insertions(+), 24 deletions(-) create mode 100644 frontend/src/components/Card.svelte diff --git a/frontend/src/components/Card.svelte b/frontend/src/components/Card.svelte new file mode 100644 index 0000000..57cac82 --- /dev/null +++ b/frontend/src/components/Card.svelte @@ -0,0 +1,71 @@ + + + + {@render children?.()} + + + diff --git a/frontend/src/routes/MediaKit.svelte b/frontend/src/routes/MediaKit.svelte index 3e7dc83..46e1054 100644 --- a/frontend/src/routes/MediaKit.svelte +++ b/frontend/src/routes/MediaKit.svelte @@ -2,6 +2,7 @@ import { onMount } from "svelte"; import { fetchMediaKit } from "../lib/api"; import type { MediaKit, Platform } from "../lib/types"; + import Card from "../components/Card.svelte"; let data = $state(null); let error = $state(""); @@ -19,11 +20,28 @@ let twitch = $derived(data?.twitch); // let twitchLogin = $derived(twitch?.login ?? ""); - let platformImageMap: Record = { - twitch: "/images/logos/twitch.svg", - youtube: "/images/logos/youtube.svg", - instagram: "/images/logos/instagram.svg", - tiktok: "/images/logos/tiktok.svg", + type platformDecoType = { + image: string; + color?: string | null; + }; + + let platformImageMap: Record = { + twitch: { + image: "/images/logos/twitch.svg", + color: "#8E60F5", + }, + youtube: { + image: "/images/logos/youtube.svg", + color: "#FF0000", + }, + instagram: { + image: "/images/logos/instagram.svg", + color: "#E1306C", + }, + tiktok: { + image: "/images/logos/tiktok.svg", + color: "#FFFFFF", + }, }; function formatCount(value: number | undefined | null): string { if (value == null) return "—"; @@ -52,30 +70,33 @@ Loading… {:else} - + - {#if content.profile_image_url} - - {/if} + + {#if content.profile_image_url} + + {/if} + - @@ -97,19 +118,20 @@ - + {#each platforms as platform (platform.name)} - @@ -137,15 +159,16 @@ - + {/each} + - + Hi there, I'm RythonDev