From 58e1ffa9effc92f5ddebee4068d5931be12201b0 Mon Sep 17 00:00:00 2001
From: Maksymilian Jopek <maks@jopek.eu>
Date: Thu, 10 Mar 2022 15:39:25 +0100
Subject: Initial commit w/ v1.0.0

---
 frontend/src/Search.svelte | 92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 frontend/src/Search.svelte

(limited to 'frontend/src/Search.svelte')

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>
-- 
cgit v1.3.1

