feat: redo how images, icons, and logos are handled
This commit is contained in:
46
src/components/images/ImageTheme.astro
Normal file
46
src/components/images/ImageTheme.astro
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
import { Image } from 'astro:assets';
|
||||
|
||||
const { srcLight, srcDark, alt, style, width, height } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="themed-image-container">
|
||||
<Image
|
||||
src={srcLight}
|
||||
alt={alt}
|
||||
class={`light-logo ${style}`}
|
||||
inferSize={true}
|
||||
width={width}
|
||||
height={height}
|
||||
inferSize={true}
|
||||
/>
|
||||
|
||||
<Image
|
||||
src={srcDark}
|
||||
alt={alt}
|
||||
class={`dark-logo ${style}`}
|
||||
inferSize={true}
|
||||
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