fix: layouting issues

This commit is contained in:
Lio 2025-08-20 12:26:53 +02:00
parent acc9df2e16
commit 65d065c489
5 changed files with 76 additions and 45 deletions

View file

@ -4,17 +4,21 @@ import Sidebar from "../components/Sidebar.astro";
import pb from "../lib/pb"; import pb from "../lib/pb";
import c from "../lib/config"; import c from "../lib/config";
const avatarRec = await pb const avatarRec = await pb
.collection("images") .collection("images")
.getFirstListItem("useAsAvatar=true").catch(() => null); .getFirstListItem("useAsAvatar=true", { requestKey: null })
.catch(() => null);
const backgroundRec = await pb const backgroundRec = await pb
.collection("images") .collection("images")
.getFirstListItem("useAsBackground=true").catch(() => null); .getFirstListItem("useAsBackground=true", { requestKey: null })
.catch(() => null);
const icon = avatarRec
const icon = avatarRec ? await pb.files.getUrl(avatarRec, avatarRec.file) : null; ? await pb.files.getUrl(avatarRec, avatarRec.file)
const background = backgroundRec ? await pb.files.getUrl(backgroundRec, backgroundRec.file) : null; : null;
const background = backgroundRec
? await pb.files.getUrl(backgroundRec, backgroundRec.file)
: null;
const socials = await pb.collection("socials").getFullList(); const socials = await pb.collection("socials").getFullList();
const config = { const config = {
@ -39,19 +43,24 @@ export const prerender = false;
<title>{config.title}</title> <title>{config.title}</title>
</head> </head>
<body> <body>
<div class="xl:flex">
<div <div
class="xl:fixed xl:left-0 xl:top-0 w-full xl:w-96 bg-[#11111156] backdrop-blur-md h-full pt-4 box-border text-center" class="static xl:h-screen xl:relative w-full xl:w-96 bg-[#11111156] backdrop-blur-md backdrop-brightness-50 h-full pt-4 box-border text-center"
> >
<Sidebar /> <Sidebar />
</div> </div>
<div
class="max-w-fit ml-auto mr-auto transition-all"
>
<slot /> <slot />
</div>
</div>
</body> </body>
</html> </html>
<style define:vars={{ background: `url(${config.background})` }}> <style define:vars={{ background: `url(${config.background})` }}>
.container {
width: calc(100% - 25rem);
} body {
body {
font-family: system-ui, sans-serif; font-family: system-ui, sans-serif;
background: var(--background); background: var(--background);
background-size: cover; background-size: cover;

View file

@ -39,25 +39,23 @@ const config = {
</head> </head>
<body> <body>
<Lightbox /> <Lightbox />
<div class="xl:flex">
<div <div
class="xl:fixed xl:left-0 xl:top-0 w-full xl:w-96 bg-[#11111156] backdrop-blur-md h-full pt-4 box-border text-center" class="tatic xl:h-screen xl:relative w-full xl:w-96 bg-[#11111156] backdrop-blur-md h-full pt-4 box-border text-center"
> >
<Sidebar /> <Sidebar />
</div> </div>
<div <div
class="container float-none xl:float-right xl:box-border transition-all" class="max-w-fit ml-auto mr-auto transition-all"
> >
<slot /> <slot />
</div> </div>
</div>
</body> </body>
</html> </html>
<style define:vars={{ background: `url(${config.background})` }}> <style define:vars={{ background: `url(${config.background})` }}>
@media screen(xl) {
.container {
width: calc(100% - 25rem);
}
}
body { body {
font-family: system-ui, sans-serif; font-family: system-ui, sans-serif;

View file

@ -20,15 +20,15 @@ const background = backgroundRec ? await pb.files.getUrl(backgroundRec, backgrou
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
<title>{config.TITLE}</title> <title>{config.TITLE}</title>
</head> </head>
<body> <body class="flex h-screen">
<div class="m-auto">
<slot /> <slot />
</div>
</body> </body>
</html> </html>
<style define:vars={{ background: `url(${background})` }}> <style define:vars={{ background: `url(${background})` }}>
.container {
width: calc(100% - 25rem);
}
body { body {
font-family: system-ui, sans-serif; font-family: system-ui, sans-serif;
background: var(--background); background: var(--background);

View file

@ -6,7 +6,7 @@ import Card from "../../components/Card.astro";
const characters = await pb const characters = await pb
.collection("characters") .collection("characters")
// @ts-ignore // @ts-ignore
.getFullList({ expand: ["icon"], filter: `(hidden = false)` }); .getFullList({ expand: ["icon"], filter: `(hidden = false)`, requestKey: null });
export const prerender = false; export const prerender = false;
--- ---
@ -14,9 +14,24 @@ export const prerender = false;
<CharacterList> <CharacterList>
<div class="flex flex-col"> <div class="flex flex-col">
<h1 class="text-3xl text-center pt-8">Characters</h1> <h1 class="text-3xl text-center pt-8">Characters</h1>
<div <!-- class="grid grid-cols-2 xl:grid-cols-4 gap-4 columns-2 md:columns-4 self-center p-4" -->
class="grid grid-cols-2 xl:grid-cols-4 gap-4 columns-2 md:columns-4 self-center p-4" <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 2xl:grid-cols-4 gap-4 self-center p-4">
> {
// @ts-ignore
characters.length === 0 && (
<div class="text-center col-span-full">
<p class="text-lg">No characters found.</p>
</div>
)
}
{
// @ts-ignore
characters.length === 0 && (
<div class="text-center col-span-full">
<p class="text-lg">No characters found.</p>
</div>
)
}
{ {
[...characters].map((c) => ( [...characters].map((c) => (
// @ts-ignore // @ts-ignore
@ -30,4 +45,13 @@ export const prerender = false;
} }
</div> </div>
</div> </div>
</CharacterList> </CharacterList>
<style>
@media screen(md) {
.container {
width: calc(100% - 25rem);
}
}
</style>

View file

@ -5,8 +5,8 @@ import IndexLayout from "../layouts/Index.astro";
--- ---
<IndexLayout> <IndexLayout>
<div class="flex flex-col "> <div class="flex flex-col items-center justify-centerß">
<div class=" flex gap-4 columns-2 md:columns-4 self-center"> <div class="mx-auto my-auto">
<Sidebar /> <Sidebar />
</div> </div>
</div> </div>