about summary refs log tree commit diff
path: root/client/src/components/Response.svelte
blob: 215af1bf42b6c1a1892ae9beda821ce7c3acfc98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<script lang="ts">
    import type { ShortenRequest } from "$actions/shorten";

    export let info: ShortenRequest;
</script>

<style>
    div {
        display: flex;
        justify-content: space-between;
    }

    .url {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .output {
        margin-left: 50px;
    }
</style>

<div>
    <span class="url">{info.url}</span>
    {#await info.response}
        <span class="output">Loading...</span>
    {:then { hash }} 
        <a class="output" href="https://sho.rest/{hash}">sho.rest/{hash}</a>
    {:catch { error }}
        <span class="output">{error}</span>
    {/await}
</div>