feat: gallery page working for each individual entity
This commit is contained in:
@ -4,19 +4,27 @@ import { SearchCardEvent } from "./SearchCardEvent";
|
|||||||
import { SearchCardLocation } from "./SearchCardLocation";
|
import { SearchCardLocation } from "./SearchCardLocation";
|
||||||
import { SearchCardNote } from "./SearchCardNote";
|
import { SearchCardNote } from "./SearchCardNote";
|
||||||
|
|
||||||
export const SearchCard = (props: { item: UserImage }) => {
|
const UnwrappedSearchCard = (props: { item: UserImage }) => {
|
||||||
const { item } = props;
|
const { item } = props;
|
||||||
|
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case "location":
|
case "location":
|
||||||
return <SearchCardLocation item={item} />;
|
return <SearchCardLocation item={item} />;
|
||||||
case "event":
|
case "event":
|
||||||
return <SearchCardEvent item={item} />;
|
return <SearchCardEvent item={item} />;
|
||||||
case "note":
|
case "note":
|
||||||
return <SearchCardNote item={item} />;
|
return <SearchCardNote item={item} />;
|
||||||
case "contact":
|
case "contact":
|
||||||
return <SearchCardContact item={item} />;
|
return <SearchCardContact item={item} />;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SearchCard = (props: { item: UserImage }) => {
|
||||||
|
return (
|
||||||
|
<div class="h-[144px] border relative col-span-3 border-neutral-200 cursor-pointer overflow-hidden rounded-xl">
|
||||||
|
<UnwrappedSearchCard item={props.item} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, For, Show } from "solid-js";
|
import { Component, For, Show } from "solid-js";
|
||||||
import { useParams } from "@solidjs/router";
|
import { A, useParams } from "@solidjs/router";
|
||||||
import { union, literal, safeParse, InferOutput, parse } from "valibot";
|
import { union, literal, safeParse, InferOutput, parse } from "valibot";
|
||||||
import { useSearchImageContext } from "../contexts/SearchImageContext";
|
import { useSearchImageContext } from "../contexts/SearchImageContext";
|
||||||
import { SearchCard } from "../components/search-card/SearchCard";
|
import { SearchCard } from "../components/search-card/SearchCard";
|
||||||
@ -24,9 +24,9 @@ const EntityGallery: Component<{
|
|||||||
images().filter((i) => i.type === props.entity);
|
images().filter((i) => i.type === props.entity);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="flex flex-col gap-4 capitalize">
|
<div class="flex flex-col gap-4 capitalize bg-white container p-4">
|
||||||
<h2>{props.entity}s</h2>
|
<h2 class="font-bold text-xl">{props.entity}s</h2>
|
||||||
<div class="grid grid-cols-3">
|
<div class="grid grid-cols-3 gap-4">
|
||||||
<For each={filteredCategories()}>
|
<For each={filteredCategories()}>
|
||||||
{(category) => <SearchCard item={category} />}
|
{(category) => <SearchCard item={category} />}
|
||||||
</For>
|
</For>
|
||||||
@ -44,6 +44,7 @@ export const Gallery: Component = () => {
|
|||||||
when={validated.success}
|
when={validated.success}
|
||||||
fallback={<p>Sorry, this entity is not supported</p>}
|
fallback={<p>Sorry, this entity is not supported</p>}
|
||||||
>
|
>
|
||||||
|
<A href="/">Home</A>
|
||||||
<EntityGallery entity={validated.output as any} />
|
<EntityGallery entity={validated.output as any} />
|
||||||
</Show>
|
</Show>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user