about summary refs log tree commit diff
path: root/assets/src/components/DataView.svelte
blob: df6db047a9ce5bfdfc068b083c4eb9125e42d33b (plain)
1
2
3
4
5
6
7
8
9
10
11
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #0000ff }
.highlight .c { color: #0F0 } /* Comment */
.highlight .err { color: #DDD } /* Error */
.highlight .esc { color: #DDD } /* Escape */
.highlight .g { color: #DDD } /* Generic */
.highlight .k { color: #F00 } /* Keyword */
.highlight .l { color: #DDD } /* Literal */
.highlight .n { color: #DDD } /* Name */
.highlight .o { color: #DDD } /* Operator */
.highlight .x { color: #DDD } /* Other */
.highlight .p { color: #DDD } /* Punctuation */
.highlight .ch { color: #0F0 } /* Comment.Hashbang */
.highlight .cm { color: #0F0 } /* Comment.Multiline */
.highlight .cp { color: #E5E5E5 } /* Comment.Preproc */
.highlight .cpf { color
<script lang="ts">
    import data from "../state/data";
    import EyeOpenedIcon from "./icons/EyeOpenedIcon.svelte";
    import EyeClosedIcon from "./icons/EyeClosedIcon.svelte";

    let hidden = true;

    function toggle() {
        hidden = !hidden;
    }
</script>

<div class="data-view">
    <input type={hidden ? "password" : "text"} value={$data.data} readonly />
    <button on:click={toggle} class="icon">
        {#if hidden}
            <EyeOpenedIcon color="black" />
        {:else}
            <EyeClosedIcon color="black" />
        {/if}
    </button>
</div>

<style>
    .data-view {
        font-size: 14px;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 20px;
        display: flex;
        align-items: center;
    }

    .icon {
        border: none;
        background: none;
        display: flex;
        align-items: center;
    }

    input {
        flex: 1;
        outline: none;
        border: none;
        padding: 0;
    }
</style>