aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/Search.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/Search.svelte')
-rw-r--r--frontend/src/Search.svelte92
1 files changed, 92 insertions, 0 deletions
diff --git a/frontend/src/Search.svelte b/frontend/src/Search.svelte
new file mode 100644
index 0000000..2f192eb
--- /dev/null
+++ b/frontend/src/Search.svelte
@@ -0,0 +1,92 @@
+<script lang="ts">
+ export let filters: any;
+ let id: number,
+ author: string,
+ title: string,
+ year: number,
+ isbn: string,
+ format: string,
+ pages: string,
+ description: string,
+ publisher: string;
+ export function clear() {
+ id = null;
+ author = null;
+ title = null;
+ year = null;
+ isbn = null;
+ format = null;
+ pages = null;
+ description = null;
+ publisher = null;
+ }
+ $: {
+ if (id) filters["id"] = id;
+ else delete filters["id"];
+ if (author) filters["author"] = author;
+ else delete filters["author"];
+ if (title) filters["title"] = title;
+ else delete filters["title"];
+ if (year) filters["year"] = year;
+ else delete filters["year"];
+ if (publisher) filters["publisher"] = publisher;
+ else delete filters["publisher"];
+ if (isbn) filters["isbn"] = isbn;
+ else delete filters["isbn"];
+ if (format) filters["format"] = format;
+ else delete filters["format"];
+ if (pages) filters["pages"] = pages;
+ else delete filters["pages"];
+ if (description) filters["description"] = description;
+ else delete filters["description"];
+ filters["key"] = Math.random();
+ }
+</script>
+
+<main>
+ <label for="id">Id:</label>
+ <input type="number" id="id" bind:value={id} /><br />
+ <label for="author">Author:</label>
+ <input type="text" id="author" bind:value={author} /><br />
+ <label for="title">Title:</label>
+ <input type="text" id="title" bind:value={title} /><br />
+ <label for="year">Year:</label>
+ <input type="number" id="year" bind:value={year} /><br />
+ <label for="publisher">Publisher:</label>
+ <input type="number" id="publisher" bind:value={publisher} /><br />
+ <label for="isbn">Isbn:</label>
+ <!-- @tsignore -->
+ <input bind:value={isbn} id="isbn" /><br />
+ <label for="format">Format:</label>
+ <input bind:value={format} id="format" /><br />
+ <label for="pages">Pages:</label>
+ <input bind:value={pages} id="pages" /><br />
+ <label for="description">Description:</label>
+ <input
+ bind:value={description}
+ id="description"
+ style="margin-bottom: 0;"
+ /><br />
+ <!-- <button on:click={search}>Filter</button> -->
+</main>
+
+<style>
+ main {
+ position: fixed;
+ left: 0;
+ right: 0;
+ margin: auto;
+ height: fit-content;
+ width: fit-content;
+ /* border: 1px solid black; */
+ font-size: 1.9em;
+ margin-bottom: 30px;
+ color: white;
+ background-color: rgba(0, 0, 0, 0.75);
+ padding: 50px;
+ }
+ input {
+ font-size: 1em;
+ margin-bottom: 30px;
+ }
+</style>