enable responsive images

This commit is contained in:
zepp 2025-03-11 19:39:52 -04:00
parent a8299178ec
commit 17ecb1c4e0
5 changed files with 18 additions and 5 deletions

View File

@ -1,5 +1,14 @@
// @ts-check // @ts-check
import { defineConfig } from 'astro/config'; import { defineConfig } from "astro/config";
// https://astro.build/config // https://astro.build/config
export default defineConfig({}); export default defineConfig({
image: {
// Used for all Markdown images; not configurable per-image
// Used for all `<Image />` and `<Picture />` components unless overridden with a prop
experimentalLayout: "responsive",
},
experimental: {
responsiveImages: true,
},
});

View File

@ -14,7 +14,7 @@ const backgroundColorNightMode = "#240046";
<header id="top"> <header id="top">
<span class="logo"> <span class="logo">
{pageTitle} <Image class="header-heart-svg" src={transPrideFlag} alt="the transgender pride flag styled with css to look like a heart" /><Image class="header-heart-svg" src={biPrideFlag} alt="the bisexual pride flag styled with css to look like a heart" /><Image class="header-heart-svg" src={disabilityPrideFlag} alt="the disability pride flag styled with css to look like a heart" /><Image class="header-heart-svg" src={redHeartFlat} alt="a red heart meant to symbolize love" /> {pageTitle} <Image class="header-heart-svg" src={transPrideFlag} alt="the transgender pride flag styled with css to look like a heart" /><Image class="header-heart-svg" src={biPrideFlag} alt="the bisexual pride flag styled with css to look like a heart" /><Image class="header-heart-svg" src={disabilityPrideFlag} alt="the disability pride flag styled with css to look like a heart" /><Image class="header-heart-svg" src={redHeartFlat} alt="a red heart meant to symbolize love" layout="none"/>
</span> </span>
<span class="motto"> <span class="motto">
{motto} {motto}

View File

@ -1,7 +1,7 @@
--- ---
import { Image } from "astro:assets"; import { Image } from "astro:assets";
import catImg from "../images/widgets/cat.gif"; import catImg from "../images/widgets/cat.webp";
const backgroundColor = "#ffd4de"; const backgroundColor = "#ffd4de";
const backgroundColorNightMode = "#240046"; const backgroundColorNightMode = "#240046";
@ -27,7 +27,7 @@ const backgroundColorNightMode = "#240046";
.cat-widget { .cat-widget {
background-color: var(--backgroundColor); background-color: var(--backgroundColor);
height: 19vw; height: auto;
width: 20vw; width: 20vw;
border-radius: 25px; border-radius: 25px;
display: flex; display: flex;
@ -35,6 +35,10 @@ const backgroundColorNightMode = "#240046";
align-items: center; align-items: center;
} }
img {
margin-bottom: 0.25rem;
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
.widget { .widget {
background-color: var(--backgroundColorNightMode); background-color: var(--backgroundColorNightMode);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
src/images/widgets/cat.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB