webapp/src/components/Nav/Notifications.tsx
2022-10-25 18:29:27 +02:00

20 lines
506 B
TypeScript

import { For, Portal, Show } from 'solid-js/web'
import { useWarningsStore } from '../../stores/ui'
import { createMemo } from 'solid-js'
export default () => {
const { warnings } = useWarningsStore()
const notSeen = createMemo(() => warnings().filter((warning) => !warning.seen))
return (
<Show when={notSeen().length > 0}>
<Portal>
<ul class="warns">
<For each={warnings()}>{(warning) => <li>{warning.body}</li>}</For>
</ul>
</Portal>
</Show>
)
}