feat: add dark mode swap to logo
This commit is contained in:
@@ -4,12 +4,11 @@ import { Image } from 'astro:assets';
|
||||
const { srcLight, srcDark, alt, style, width, height } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="themed-image-container">
|
||||
<div class="grid grid-cols-1 grid-rows-1">
|
||||
<Image
|
||||
src={srcLight}
|
||||
alt={alt}
|
||||
class={`light-logo ${style}`}
|
||||
inferSize={true}
|
||||
class:list={['col-start-1 row-start-1 transition-all duration-400 ease-in-out opacity-100 scale-100 dark:opacity-0 dark:scale-65', style]}
|
||||
width={width}
|
||||
height={height}
|
||||
inferSize={true}
|
||||
@@ -18,29 +17,9 @@ const { srcLight, srcDark, alt, style, width, height } = Astro.props;
|
||||
<Image
|
||||
src={srcDark}
|
||||
alt={alt}
|
||||
class={`dark-logo ${style}`}
|
||||
inferSize={true}
|
||||
class:list={['col-start-1 row-start-1 transition-all duration-400 ease-in-out opacity-0 scale-65 dark:opacity-100 dark:scale-100', style]}
|
||||
width={width}
|
||||
height={height}
|
||||
inferSize={true}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.themed-image-container {
|
||||
display: grid;
|
||||
grid-template-areas: "stack";
|
||||
}
|
||||
|
||||
.themed-image-container :global(img) {
|
||||
grid-area: stack;
|
||||
}
|
||||
|
||||
:global(.dark) .light-logo {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
:global(.dark) .dark-logo {
|
||||
display: block !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user