2024-09-06 23:01:00 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
2024-09-08 19:35:11 +02:00
|
|
|
import DotsCircleHorizontal from "@rgossiaux/svelte-heroicons/solid/DotsCircleHorizontal"
|
2024-09-06 23:01:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A menu, opened by a dot
|
|
|
|
*/
|
2024-09-10 02:19:55 +02:00
|
|
|
|
2024-09-08 19:35:11 +02:00
|
|
|
export let open = new UIEventSource(false)
|
2024-09-06 23:01:00 +02:00
|
|
|
|
2024-09-08 19:35:11 +02:00
|
|
|
function toggle() {
|
|
|
|
open.set(!open.data)
|
2024-09-06 23:01:00 +02:00
|
|
|
}
|
2024-09-10 02:19:55 +02:00
|
|
|
|
|
|
|
|
2024-09-06 23:01:00 +02:00
|
|
|
</script>
|
|
|
|
|
2024-09-08 19:35:11 +02:00
|
|
|
<div class="relative" style="z-index: 50">
|
|
|
|
<div
|
2024-09-10 02:19:55 +02:00
|
|
|
class="sidebar-unit absolute right-0 top-0 collapsable normal-background button-unstyled"
|
2024-09-08 19:35:11 +02:00
|
|
|
class:collapsed={!$open}>
|
2024-09-06 23:01:00 +02:00
|
|
|
<slot />
|
2024-09-08 19:35:11 +02:00
|
|
|
</div>
|
|
|
|
<DotsCircleHorizontal class={ `absolute top-0 right-0 w-6 h-6 dots-menu transition-colors ${$open?"dots-menu-opened":""}`} on:click={toggle} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.dots-menu{
|
|
|
|
z-index: 50;
|
|
|
|
}
|
|
|
|
:global(.dots-menu > path) {
|
|
|
|
fill: var(--interactive-background);
|
|
|
|
transition: fill 350ms linear;
|
2024-09-10 02:19:55 +02:00
|
|
|
cursor: pointer;
|
2024-09-08 19:35:11 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
:global(.dots-menu:hover > path, .dots-menu-opened > path) {
|
|
|
|
fill: var(--interactive-foreground)
|
|
|
|
}
|
|
|
|
|
|
|
|
.collapsable {
|
|
|
|
max-width: 100rem;
|
|
|
|
max-height: 100rem;
|
2024-09-10 02:19:55 +02:00
|
|
|
transition: border 150ms linear, max-width 500ms linear, max-height 500ms linear;
|
2024-09-08 19:35:11 +02:00
|
|
|
overflow: hidden;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
text-wrap: none;
|
|
|
|
width: max-content;
|
|
|
|
box-shadow: #ccc ;
|
|
|
|
white-space: nowrap;
|
2024-09-10 02:19:55 +02:00
|
|
|
border: 1px solid var(--button-background);
|
2024-09-08 19:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.collapsed {
|
|
|
|
max-width: 0;
|
2024-09-10 02:19:55 +02:00
|
|
|
max-height: 0;
|
|
|
|
border: 2px solid #00000000;
|
|
|
|
pointer-events: none;
|
2024-09-08 19:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|