feat: frontend page images

This commit is contained in:
2025-07-18 15:24:44 +01:00
parent 4870a8b1b1
commit 300a4925df
3 changed files with 33 additions and 25 deletions

View File

@ -4,8 +4,11 @@ import { A } from "@solidjs/router";
export const ImageComponent: Component<{ ID: string }> = (props) => { export const ImageComponent: Component<{ ID: string }> = (props) => {
return ( return (
<A href={`/image/${props.ID}`}> <A href={`/image/${props.ID}`} class="w-full h-full">
<img src={`${base}/image/${props.ID}`} /> <img
class="w-full h-full object-contain"
src={`${base}/image/${props.ID}`}
/>
</A> </A>
); );
}; };

View File

@ -14,11 +14,13 @@ export const Recent: Component = () => {
.slice(0, 10); .slice(0, 10);
return ( return (
<div> <div class="rounded-xl bg-white p-4 flex flex-col gap-2">
<h2>Recent</h2> <h2 class="text-xl font-bold">Recent Screenshots</h2>
<For each={latestImages()}> <div class="grid grid-cols-3 place-items-center">
{(image) => <ImageComponent ID={image.ImageID} />} <For each={latestImages()}>
</For> {(image) => <ImageComponent ID={image.ImageID} />}
</For>
</div>
</div> </div>
); );
}; };

View File

@ -20,24 +20,27 @@ export const Categories: Component = () => {
const { categories } = useSearchImageContext(); const { categories } = useSearchImageContext();
return ( return (
<div class="w-full grid grid-cols-4 auto-rows-[minmax(100px,1fr)] gap-4 rounded-xl bg-white p-4"> <div class="rounded-xl bg-white p-4 flex flex-col gap-2">
<For each={Object.entries(categories())}> <h2 class="text-xl font-bold">Entities</h2>
{([category, group]) => ( <div class="w-full grid grid-cols-4 auto-rows-[minmax(100px,1fr)] gap-4">
<A <For each={Object.entries(categories())}>
href={`/gallery/${category}`} {([category, group]) => (
class={ <A
"col-span-2 flex flex-col justify-center items-center rounded-lg p-4 border border-neutral-200 " + href={`/gallery/${category}`}
"capitalize " + class={
CategoryColor[category as keyof typeof CategoryColor] + "col-span-2 flex flex-col justify-center items-center rounded-lg p-4 border border-neutral-200 " +
" " + "capitalize " +
(group.length === 0 ? "row-span-1 order-10" : "row-span-2") CategoryColor[category as keyof typeof CategoryColor] +
} " " +
> (group.length === 0 ? "row-span-1 order-10" : "row-span-2")
<p class="text-xl font-bold">{category}s</p> }
<p class="text-lg">{group.length}</p> >
</A> <p class="text-xl font-bold">{category}s</p>
)} <p class="text-lg">{group.length}</p>
</For> </A>
)}
</For>
</div>
</div> </div>
); );
}; };