Compare commits

...

2 Commits

Author SHA1 Message Date
Tomáš Mládek 97f6dd86bf style(webui): LabelBorder hidden state is indicated by double border
ci/woodpecker/push/woodpecker Pipeline failed Details
2024-04-12 15:21:43 +02:00
Tomáš Mládek 041c058a77 refactor(webui): LabelBorder uses Svelte transitions, tidy CSS 2024-04-12 15:20:47 +02:00
1 changed files with 27 additions and 22 deletions

View File

@ -1,4 +1,6 @@
<script lang="ts">
import { slide } from 'svelte/transition';
export let hide = false;
let hidden = true;
</script>
@ -6,28 +8,35 @@
<section class="labelborder" class:hide class:hidden>
<header
on:click={() => {
if (hide) {
hidden = !hidden;
}
if (hide) hidden = !hidden;
}}
on:keydown={(ev) => {
if (['Space', 'Enter'].includes(ev.key) && hide) hidden = !hidden;
}}
role="button"
tabindex="0"
>
<slot name="header-full">
<h3><slot name="header" /></h3>
<h3>
<slot name="header" />
</h3>
</slot>
</header>
<div class="content">
<slot />
</div>
{#if !hide || !hidden}
<div class="content" transition:slide>
<slot />
</div>
{:else}
<div class="hidden-indicator" />
{/if}
</section>
<style lang="scss">
<style>
section.labelborder {
margin-top: 0.66rem;
transition: opacity 0.5s ease-in-out;
header {
& header {
display: flex;
align-items: end;
justify-content: space-between;
@ -36,28 +45,24 @@
padding-bottom: 0.33rem;
margin-bottom: 0.33rem;
h3 {
& h3 {
margin: 0;
}
}
&.hide {
header {
& header {
cursor: pointer;
}
}
transition: opacity 0.2s ease-in-out;
&.hidden {
opacity: 0.66;
&.hide.hidden {
opacity: 0.66;
}
header {
border-bottom-width: 0.5px;
}
.content {
display: none;
}
}
& .hidden-indicator {
border-top: 1px solid var(--foreground);
margin-top: calc(-0.33rem + 2px);
}
}
</style>