2021-03-25 23:32:23 +01:00
|
|
|
<script lang="typescript">
|
2021-03-30 15:56:54 +02:00
|
|
|
import DropdownItem from "./DropdownItem.svelte";
|
2021-03-30 06:14:00 +02:00
|
|
|
import type { Readable } from "svelte/store";
|
|
|
|
import { setContext } from "svelte";
|
|
|
|
import { disabledKey, nightModeKey } from "./contextKeys";
|
|
|
|
|
2021-03-29 21:48:31 +02:00
|
|
|
import ButtonGroup from "./ButtonGroup.svelte";
|
2021-03-30 01:23:39 +02:00
|
|
|
import type { Buttons } from "./ButtonGroup.svelte";
|
2021-03-25 23:32:23 +01:00
|
|
|
|
2021-03-30 01:23:39 +02:00
|
|
|
export let buttons: Buttons = [];
|
2021-03-25 23:32:23 +01:00
|
|
|
export let nightMode: boolean;
|
2021-03-30 06:14:00 +02:00
|
|
|
export let disabled: Readable<boolean> = false;
|
2021-03-25 23:32:23 +01:00
|
|
|
|
2021-03-30 06:14:00 +02:00
|
|
|
setContext(disabledKey, disabled);
|
|
|
|
setContext(nightModeKey, nightMode);
|
2021-03-25 21:11:40 +01:00
|
|
|
</script>
|
|
|
|
|
2021-03-30 00:51:44 +02:00
|
|
|
<style lang="scss">
|
2021-03-30 15:56:54 +02:00
|
|
|
nav {
|
2021-03-30 00:51:44 +02:00
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2021-03-30 03:11:51 +02:00
|
|
|
z-index: 10;
|
2021-03-30 00:51:44 +02:00
|
|
|
|
|
|
|
background: var(--bg-color);
|
2021-03-30 01:23:39 +02:00
|
|
|
border-bottom: 1px solid var(--border);
|
|
|
|
|
|
|
|
/* Remove most outer marigns */
|
|
|
|
& > :global(ul) {
|
|
|
|
& > :global(li:nth-child(1)) {
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
& > :global(li:nth-last-child(1)) {
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
2021-03-30 00:51:44 +02:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2021-03-30 15:56:54 +02:00
|
|
|
<ul class="dropdown-menu" id="dropdownMenuButton123" aria-labelledby="dropdownMenuButton123">
|
|
|
|
<DropdownItem>
|
|
|
|
<svelte:fragment slot="start">Action</svelte:fragment>
|
|
|
|
<svelte:fragment slot="end">Shortcut</svelte:fragment>
|
|
|
|
</DropdownItem>
|
|
|
|
<DropdownItem>Action 1</DropdownItem>
|
|
|
|
<DropdownItem>Action 2</DropdownItem>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<nav>
|
2021-03-30 00:51:44 +02:00
|
|
|
<ButtonGroup {buttons} />
|
2021-03-30 15:56:54 +02:00
|
|
|
</nav>
|