From abbed1d6b480f0c634b6fae3f23d3584b515989f Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Fri, 4 Sep 2026 11:22:58 +0800 Subject: [PATCH] updated projects component --- src/components/projects/Project.astro | 99 ++++++++------- .../projects/ProjectsComponent.astro | 21 +--- src/components/projects/TaskWidget.svelte | 115 ++++++++++-------- src/components/projects/VideoProject.svelte | 50 ++++---- 4 files changed, 146 insertions(+), 139 deletions(-) diff --git a/src/components/projects/Project.astro b/src/components/projects/Project.astro index 91365c8..2f04075 100644 --- a/src/components/projects/Project.astro +++ b/src/components/projects/Project.astro @@ -26,6 +26,35 @@ const { } = Astro.props; const leftProject = position == "left"; +const side = leftProject ? "left" : "right"; +const layers = ["background", "frontfacing"] as const; + +const renderLayer = ( + src: ImageMetadata, + theme: "dark" | "light", + layer: (typeof layers)[number], +) => { + const isBackground = layer === "background"; + const isLight = theme === "light"; + + return { + src, + class: [ + "absolute top-1/2 left-1/2 aspect-video max-w-full rounded-xl border-2 border-solid", + isLight + ? "project-image-light hidden border-gray-300" + : "project-image-dark border-gray-800", + isBackground ? "background-img opacity-40" : "frontfacing-img opacity-100", + isBackground && isLight ? "brightness-75" : "", + side, + ] + .filter(Boolean) + .join(" "), + classList: { + "has-light-image": !isLight && Boolean(image_light), + }, + }; +}; ---