Fix DeckOptions toolbar having wrong margins and no flex-grow (#1464)

ButtonToolbar.svelte now has to assume that the button elements
are two levels below it. This can be simplified once we can use
flex-gap.
This commit is contained in:
Henrik Giesel 2021-10-28 11:37:52 +02:00 committed by GitHub
parent 7e23c9fe4f
commit afc56a8398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 37 deletions

View file

@ -58,8 +58,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</script>
<!-- div is necessary to preserve item position -->
<div {id} {style}>
<div {id} class="button-group-item" {style}>
<Detachable {detached}>
<slot />
</Detachable>
</div>
<style lang="scss">
.button-group-item {
display: contents;
}
</style>

View file

@ -103,8 +103,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
.button-toolbar {
flex-wrap: var(--buttons-wrap);
padding: 0.15rem 0;
> :global(*) {
> :global(*) > :global(*) {
/* TODO replace with gap once available */
margin-right: 0.15rem;
margin-bottom: 0.15rem;

View file

@ -12,7 +12,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let api: Record<string, never> | undefined = undefined;
</script>
<div {id} class={`container mb-1 ${className}`}>
<div {id} class="container {className}">
<Section {api}>
<slot />
</Section>

View file

@ -35,8 +35,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</div>
<style lang="scss">
/* TODO reactivate this once we can use CSS gap */
/* .item { */
/* display: contents; */
/* } */
.item {
display: contents;
}
</style>

View file

@ -10,12 +10,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let height: number = 0;
</script>
<footer {id} bind:offsetHeight={height} class="container-fluid pt-1 {className}">
<footer {id} bind:offsetHeight={height} class="sticky-footer {className}">
<slot />
</footer>
<style lang="scss">
footer {
.sticky-footer {
position: sticky;
left: 0;
right: 0;

View file

@ -8,12 +8,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export { className as class };
</script>
<header {id} class="container-fluid pb-1 {className}">
<header {id} class="sticky-header container-fluid {className}">
<slot />
</header>
<style lang="scss">
header {
.sticky-header {
position: sticky;
left: 0;
right: 0;

View file

@ -15,6 +15,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import Item from "../components/Item.svelte";
import ButtonGroup from "../components/ButtonGroup.svelte";
import ButtonGroupItem from "../components/ButtonGroupItem.svelte";
import Container from "../components/Container.svelte";
import SelectButton from "../components/SelectButton.svelte";
import SelectOption from "../components/SelectOption.svelte";
@ -88,31 +89,33 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/>
<StickyHeader class="g-1">
<ButtonToolbar class="justify-content-between" size={2.3} wrap={false}>
<Item>
<ButtonGroup class="flex-grow-1">
<ButtonGroupItem>
<SelectButton class="flex-grow-1" on:change={blur}>
{#each $configList as entry}
<SelectOption
value={String(entry.idx)}
selected={entry.current}
>
{configLabel(entry)}
</SelectOption>
{/each}
</SelectButton>
</ButtonGroupItem>
</ButtonGroup>
</Item>
<Container>
<ButtonToolbar class="justify-content-between" size={2.3} wrap={false}>
<Item>
<ButtonGroup class="flex-grow-1">
<ButtonGroupItem>
<SelectButton class="flex-grow-1" on:change={blur}>
{#each $configList as entry}
<SelectOption
value={String(entry.idx)}
selected={entry.current}
>
{configLabel(entry)}
</SelectOption>
{/each}
</SelectButton>
</ButtonGroupItem>
</ButtonGroup>
</Item>
<Item>
<SaveButton
{state}
on:add={promptToAdd}
on:clone={promptToClone}
on:rename={promptToRename}
/>
</Item>
</ButtonToolbar>
<Item>
<SaveButton
{state}
on:add={promptToAdd}
on:clone={promptToClone}
on:rename={promptToRename}
/>
</Item>
</ButtonToolbar>
</Container>
</StickyHeader>