add: responsive

This commit is contained in:
guamss 2026-06-04 21:02:08 +02:00
parent 9fec08ed33
commit 43ad397654
4 changed files with 96 additions and 33 deletions

View File

@ -6,7 +6,7 @@ import Layout from "../../components/Layout.astro";
import { Photo } from "../../models/photo"; import { Photo } from "../../models/photo";
const { filename } = Astro.params; const { filename } = Astro.params;
import { PHOTO_DIR_ABSOLUTE_PATH } from "astro:env/server"; import { PHOTO_DIR_ABSOLUTE_PATH } from "astro:env/server";
import { initPhoto, initPhotos } from "../../misc"; import { initPhoto } from "../../misc";
const relativePath = `../../assets/IMG/${filename}`; const relativePath = `../../assets/IMG/${filename}`;
const allImages: any = import.meta.glob("../../assets/IMG/*.JPG", { const allImages: any = import.meta.glob("../../assets/IMG/*.JPG", {
@ -46,9 +46,9 @@ if (imageImport && filename) {
/> />
</a> </a>
<div> <div>
<p><strong>Description de l'image : </strong>{p.description}</p> <p><span>Description de l'image : </span>{p.description}</p>
<p><strong>Modèle de l'appareil : </strong>{p.model}</p> <p><span>Modèle de l'appareil : </span>{p.model}</p>
<p><strong>Dimension de l'image : </strong>{p.width}x{p.height}</p> <p><span>Dimension de l'image : </span>{p.width}x{p.height}</p>
</div> </div>
</main> </main>
</article> </article>

View File

@ -5,15 +5,54 @@ article {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
main { > main {
display: flex; display: flex;
align-items: center; align-items: flex-start;
justify-content: space-between; gap: 2rem;
img { > a {
max-width: 80%; display: inline-block;
border: 4px solid #ffb8e0; max-width: 60%;
min-width: 60%;
> img {
width: 100%;
height: auto;
border: 4px solid var(--secondary-background-color);
border-radius: 4px; border-radius: 4px;
} }
} }
> div {
display: flex;
flex-direction: column;
gap: 1rem;
align-items: flex-start;
> p {
margin: 0;
> span {
font-weight: bold;
}
}
}
}
}
@media screen and (max-width: 900px) {
article {
justify-content: center;
align-items: center;
> main {
flex-direction: column;
align-items: center;
> a {
max-width: 95%;
min-width: 95%;
}
}
}
} }

View File

@ -1,8 +1,8 @@
:root { :root {
--primary-background-color: #ffedfa; --primary-background-color: #3a0519;
--secondary-background-color: #ffb8e0; --secondary-background-color: #670d2f;
--font-color: #be5985; --font-hover: #a53860;
--font-hover: #ec7fa9; --font-color: #ef88ad;
} }
* { * {
@ -18,15 +18,15 @@ body {
width: 100%; width: 100%;
height: 100%; height: 100%;
div { > div {
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
header { > header {
width: 95%; width: 95%;
nav { > nav {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
justify-content: space-between; justify-content: space-between;
@ -34,7 +34,7 @@ body {
margin: 2rem 0; margin: 2rem 0;
background-color: var(--secondary-background-color); background-color: var(--secondary-background-color);
button { > button {
background-color: transparent; background-color: transparent;
border: none; border: none;
margin: 0; margin: 0;
@ -45,25 +45,37 @@ body {
appearance: none; appearance: none;
} }
a, > a,
button { button {
padding: 0 1rem; padding: 0 1rem;
text-decoration: none; text-decoration: none;
color: var(--font-color); color: var(--font-color);
transition: 0.2s; transition: 0.2s;
}
a:hover, &:hover {
button:hover {
scale: 1.02; scale: 1.02;
cursor: pointer; cursor: pointer;
color: var(--font-hover); color: var(--font-hover);
} }
} }
} }
}
footer { > footer {
margin: 4rem; margin: 4rem;
} }
} }
} }
@media screen and (max-width: 450px) {
body div {
> header nav {
flex-direction: column;
align-items: center;
}
> footer {
text-align: center;
}
}
}

View File

@ -6,17 +6,29 @@ main {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 1rem; gap: 1rem;
img { a img {
width: 100%; width: 100%;
aspect-ratio: 16 / 9; aspect-ratio: 16 / 9;
object-fit: cover; object-fit: cover;
border-radius: 4px; border-radius: 4px;
transition: 0.2s; transition: 0.2s;
border: 4px solid #ffb8e0; border: 4px solid var(--secondary-background-color);
&:hover {
scale: 1.02;
border: 3px solid var(--font-hover);
}
}
} }
img:hover { @media screen and (max-width: 600px) {
scale: 1.02; main {
border: 3px solid #ec7fa9; grid-template-columns: 1fr;
}
}
@media screen and (min-width: 600px) and (max-width: 900px) {
main {
grid-template-columns: repeat(2, 1fr);
} }
} }