summaryrefslogtreecommitdiff
path: root/hi-ui/src/lib/Channel.svelte
blob: 80c45058452c4f1813f11a6e7f66fa0a932c6f3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script>
    import { activeChannel } from '../store';

    export let id;
    export let name;
    let active = false;

    activeChannel.subscribe((value) => {
        active = value ? value.id == id : false;
    });

    function activate() {
        activeChannel.update(() => ({ id, name }));
    }
</script>

<li
    class="cursor-pointer hover:bg-teal-100"
    class:bg-teal-300={active}
    on:click={activate}
>
    #{name}
</li>