[ui] first step of search
parent
0dab348f58
commit
ec691b3717
|
@ -0,0 +1,48 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { UpEntry } from "upend";
|
||||||
|
import UpObject from "./UpObject.svelte";
|
||||||
|
|
||||||
|
export let entry: UpEntry;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="entry">
|
||||||
|
<div class="entity">
|
||||||
|
<UpObject address={entry.entity} />
|
||||||
|
</div>
|
||||||
|
<div class="attribute">
|
||||||
|
{entry.attribute}
|
||||||
|
</div>
|
||||||
|
<div class="value value-{entry.value.t.toLowerCase()}">
|
||||||
|
{#if entry.value.t === "Address"}
|
||||||
|
<UpObject address={String(entry.value.c)} />
|
||||||
|
{:else}
|
||||||
|
{entry.value.c}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.entry {
|
||||||
|
border: 1px solid var(--foreground);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0.5em;
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1em;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
flex: 33%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute {
|
||||||
|
font-weight: bold;
|
||||||
|
flex-grow: 1;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.value-value) {
|
||||||
|
font-family: var(--monospace-font);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -3,6 +3,7 @@
|
||||||
import debounce from "lodash/debounce";
|
import debounce from "lodash/debounce";
|
||||||
import { Readable, readable } from "svelte/store";
|
import { Readable, readable } from "svelte/store";
|
||||||
import type { UpListing } from "upend";
|
import type { UpListing } from "upend";
|
||||||
|
import UpEntry from "../components/display/UpEntry.svelte";
|
||||||
export let query: string;
|
export let query: string;
|
||||||
|
|
||||||
let debouncedQuery = "";
|
let debouncedQuery = "";
|
||||||
|
@ -22,10 +23,34 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{#if $result}
|
{#if $result}
|
||||||
{#each $result.entries as entry}
|
<section>
|
||||||
{entry.toString()}
|
<h2>Objects</h2>
|
||||||
{:else}
|
</section>
|
||||||
No results.
|
<section>
|
||||||
{/each}
|
<h2>Raw results</h2>
|
||||||
|
<ul>
|
||||||
|
{#each $result.entries as entry}
|
||||||
|
<li><UpEntry {entry} /></li>
|
||||||
|
{:else}
|
||||||
|
<li>No results.</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
h2 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 1em auto;
|
||||||
|
width: 66em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue