summaryrefslogtreecommitdiff
path: root/hi-ui/src/lib/Channel.svelte
blob: 9922af6290164fb71e2c935164b94448021d49ef (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
<script>
    import { activeChannel } from '../store';

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

    activeChannel.subscribe((value) => {
        active = value.is(id);
    });

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

<li
    class="rounded-full"
    class:bg-slate-400={active}
    on:click={activate}
>
<a href="">
    <span class="badge bg-primary-500">#</span>
    <span class="flex-auto">{name}</span>
</a>
</li>