2021-04-15 15:59:52 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2021-04-01 01:22:06 +02:00
|
|
|
<script lang="typescript">
|
2021-04-14 19:36:41 +02:00
|
|
|
import { getContext } from "svelte";
|
|
|
|
import { nightModeKey } from "./contextKeys";
|
|
|
|
|
2021-04-09 22:02:34 +02:00
|
|
|
export let id: string;
|
2021-04-01 01:22:06 +02:00
|
|
|
export let className = "";
|
2021-04-08 16:40:42 +02:00
|
|
|
export let tooltip: string;
|
2021-04-01 01:22:06 +02:00
|
|
|
|
2021-04-01 18:55:34 +02:00
|
|
|
export let onClick: (event: MouseEvent) => void;
|
2021-04-01 01:22:06 +02:00
|
|
|
export let label: string;
|
|
|
|
export let endLabel: string;
|
2021-04-14 19:36:41 +02:00
|
|
|
|
|
|
|
const nightMode = getContext(nightModeKey);
|
2021-04-01 01:22:06 +02:00
|
|
|
</script>
|
|
|
|
|
2021-04-14 19:36:41 +02:00
|
|
|
<style lang="scss">
|
2021-04-16 18:14:09 +02:00
|
|
|
@use 'ts/sass/button_mixins' as button;
|
2021-04-14 19:36:41 +02:00
|
|
|
|
|
|
|
button {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
2021-04-16 18:36:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.btn-day {
|
|
|
|
color: black;
|
2021-04-14 19:36:41 +02:00
|
|
|
|
2021-04-16 18:14:09 +02:00
|
|
|
&:active {
|
|
|
|
background-color: button.$focus-color;
|
2021-04-14 19:36:41 +02:00
|
|
|
color: white;
|
2021-04-16 18:14:09 +02:00
|
|
|
}
|
|
|
|
}
|
2021-04-14 19:36:41 +02:00
|
|
|
|
2021-04-16 18:14:09 +02:00
|
|
|
.btn-night {
|
|
|
|
color: white;
|
2021-04-14 19:36:41 +02:00
|
|
|
|
2021-04-16 18:14:09 +02:00
|
|
|
&:hover,
|
2021-04-14 19:36:41 +02:00
|
|
|
&:focus {
|
2021-04-16 18:14:09 +02:00
|
|
|
@include button.btn-night-base;
|
2021-04-14 19:36:41 +02:00
|
|
|
}
|
2021-04-16 18:36:54 +02:00
|
|
|
|
|
|
|
&:active {
|
|
|
|
background-color: button.$focus-color;
|
|
|
|
color: white;
|
|
|
|
}
|
2021-04-14 19:36:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
span {
|
|
|
|
font-size: calc(var(--toolbar-size) / 2.3);
|
|
|
|
color: inherit;
|
|
|
|
}
|
2021-04-15 15:20:37 +02:00
|
|
|
|
|
|
|
.monospace {
|
|
|
|
font-family: monospace;
|
|
|
|
}
|
2021-04-14 19:36:41 +02:00
|
|
|
</style>
|
|
|
|
|
2021-04-01 01:22:06 +02:00
|
|
|
<button
|
|
|
|
{id}
|
2021-04-14 19:36:41 +02:00
|
|
|
class={`btn dropdown-item ${className}`}
|
2021-04-16 18:14:09 +02:00
|
|
|
class:btn-day={!nightMode}
|
|
|
|
class:btn-night={nightMode}
|
2021-04-08 16:40:42 +02:00
|
|
|
title={tooltip}
|
2021-04-01 01:22:06 +02:00
|
|
|
on:click={onClick}
|
|
|
|
on:mousedown|preventDefault>
|
2021-04-15 15:20:37 +02:00
|
|
|
<span class:me-3={endLabel}>{label}</span>
|
|
|
|
{#if endLabel}<span class="monospace">{endLabel}</span>{/if}
|
2021-04-01 01:22:06 +02:00
|
|
|
</button>
|