<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>
