Adjust ButtonDropdown for night mode

This commit is contained in:
Henrik Giesel 2021-04-16 17:14:47 +02:00
parent 21dced4ae8
commit f2e313664c
3 changed files with 17 additions and 5 deletions

View File

@ -3,6 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="typescript">
import { getContext } from "svelte";
import { nightModeKey } from "./contextKeys";
import type { ToolbarItem } from "./types";
import ButtonGroup from "./ButtonGroup.svelte";
@ -10,10 +12,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let className = "";
function extendClassName(className: string): string {
return `dropdown-menu bg-transparent border-0 ${className}`;
return `dropdown-menu py-1 mb-0 ${
nightMode ? "btn-dropdown-menu--night-mode " : ""
}${className}`;
}
export let buttons: ToolbarItem[];
const nightMode = getContext(nightModeKey);
</script>
<style>
:global(.btn-dropdown-menu--night-mode) {
background-color: var(--window-bg);
border-color: var(--medium-border);
}
</style>
<ButtonGroup {id} className={extendClassName(className)} {buttons} />

View File

@ -20,14 +20,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<style lang="scss">
ul {
display: inline-flex;
display: flex;
justify-items: start;
flex-wrap: var(--toolbar-wrap);
overflow-y: auto;
padding-inline-start: 0;
margin-bottom: 0;
margin: 0 0 calc(var(--toolbar-size) / 15);
}
.border-group {
@ -40,7 +40,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
li {
display: inline-block;
margin-bottom: calc(var(--toolbar-size) / 15);
> :global(button),
> :global(select) {

View File

@ -74,5 +74,5 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</div>
<nav {style}>
<ButtonGroup buttons={_buttons} />
<ButtonGroup buttons={_buttons} className="mt-0" />
</nav>