From 205f97c8efae59a640132b93a1d5d6a91939c2e3 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Thu, 3 Oct 2024 14:43:47 +0200 Subject: [PATCH] Change import of image --- src/lib/images/github-education-program/index.ts | 6 ++++++ .../github-education-program/+page.svelte | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 src/lib/images/github-education-program/index.ts diff --git a/src/lib/images/github-education-program/index.ts b/src/lib/images/github-education-program/index.ts new file mode 100644 index 000000000..663bc4c27 --- /dev/null +++ b/src/lib/images/github-education-program/index.ts @@ -0,0 +1,6 @@ +import ArtworkDark from './artwork-dark.svg'; +import ArtworkDarkMobile from './artwork-dark-mobile.svg'; +import ArtworkLight from './artwork-light.svg'; +import ArtworkLightMobile from './artwork-light-mobile.svg'; + +export { ArtworkDark, ArtworkDarkMobile, ArtworkLight, ArtworkLightMobile }; diff --git a/src/routes/(public)/(guest)/register/github-education-program/+page.svelte b/src/routes/(public)/(guest)/register/github-education-program/+page.svelte index d29f1b8e5..761f2d1f7 100644 --- a/src/routes/(public)/(guest)/register/github-education-program/+page.svelte +++ b/src/routes/(public)/(guest)/register/github-education-program/+page.svelte @@ -7,6 +7,12 @@ import AppwriteLogoLight from '$lib/images/appwrite-logo-light.svg'; import GithubLogoDark from '$lib/images/github-logo-dark.svg'; import GithubLogoLight from '$lib/images/github-logo-light.svg'; + import { + ArtworkDark, + ArtworkDarkMobile, + ArtworkLightMobile, + ArtworkLight + } from '$lib/images/github-education-program'; let artworkImageSrc; getArtworkImageSrc(); @@ -15,15 +21,13 @@ function getArtworkImageSrc() { let isMobile = window.matchMedia('(max-width: 767px)').matches; if ($app.themeInUse === 'light' && isMobile) { - artworkImageSrc = - '/console/src/lib/images/github-education-program/artwork-light-mobile.svg'; + artworkImageSrc = ArtworkLightMobile; } else if ($app.themeInUse === 'light' && !isMobile) { - artworkImageSrc = '/console/src/lib/images/github-education-program/artwork-light.svg'; + artworkImageSrc = ArtworkLight; } else if ($app.themeInUse === 'dark' && isMobile) { - artworkImageSrc = - '/console/src/lib/images/github-education-program/artwork-dark-mobile.svg'; + artworkImageSrc = ArtworkDarkMobile; } else { - artworkImageSrc = '/console/src/lib/images/github-education-program/artwork-dark.svg'; + artworkImageSrc = ArtworkDark; } }