embryo till sök

This commit is contained in:
2025-09-09 17:41:55 +02:00
parent 01e341fce0
commit e23822b30c
6 changed files with 76 additions and 12 deletions

View File

@@ -5,13 +5,26 @@ import { author } from "../types/types";
const BookList: Component = () => {
const [authors, setAuthors] = createSignal<author[]>([]);
const [query, setQuery] = createSignal("");
const update = (query: string) => {
setQuery(query);
BibblanService.getAuthors(query).then(setAuthors);
};
onMount(() => {
BibblanService.getAuthors().then(setAuthors);
});
return (
<div>
<h1>Books!</h1>
<h1>Authors!</h1>
<input
type="text"
class="form-control mb-3"
placeholder="Search..."
onInput={(e) => update(e.currentTarget.value)}
/>
<div class="book-grid d-flex flex-wrap justify-content-between gap-3 p-3">
<For each={authors()}>{(item) => <AuthorCard author={item} />}</For>
</div>