Add Container.svelte

This commit is contained in:
Henrik Giesel 2021-05-29 17:01:56 +02:00
parent cf9bba0807
commit 2728b5fa63
4 changed files with 36 additions and 7 deletions

View file

@ -0,0 +1,19 @@
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import Section from "./Section.svelte";
export let id: string | undefined = undefined;
let className: string = "";
export { className as class };
export let api: Record<string, never> | undefined = undefined;
</script>
<div {id} class={`container mb-1 ${className}`}>
<Section {api}>
<slot />
</Section>
</div>

View file

@ -13,8 +13,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { makeInterface } from "./registration"; import { makeInterface } from "./registration";
export let id: string | undefined = undefined; export let id: string | undefined = undefined;
let className: string = "";
export { className as class };
function makeRegistration(): Registration { function makeRegistration(): Registration {
const detach = writable(false); const detach = writable(false);
@ -55,7 +53,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
} }
</script> </script>
<div bind:this={sectionRef} {id} class={`container mb-1 ${className}`}> <div bind:this={sectionRef} {id}>
<slot /> <slot />
{#each $dynamicItems as item} {#each $dynamicItems as item}
<SectionItem id={item[0].id} registration={item[1]}> <SectionItem id={item[0].id} registration={item[1]}>
@ -63,3 +61,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</SectionItem> </SectionItem>
{/each} {/each}
</div> </div>
<style lang="scss">
div {
display: contents;
}
</style>

View file

@ -3,7 +3,7 @@ Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
--> -->
<script lang="ts"> <script lang="ts">
import Section from "components/Section.svelte"; import Container from "components/Container.svelte";
import SectionItem from "components/SectionItem.svelte"; import SectionItem from "components/SectionItem.svelte";
import DailyLimits from "./DailyLimits.svelte"; import DailyLimits from "./DailyLimits.svelte";
@ -21,7 +21,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let options: Record<string, never>; export let options: Record<string, never>;
</script> </script>
<Section api={options}> <Container api={options}>
<SectionItem> <SectionItem>
<DailyLimits {state} /> <DailyLimits {state} />
</SectionItem> </SectionItem>
@ -54,4 +54,4 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<SectionItem> <SectionItem>
<AdvancedOptions {state} /> <AdvancedOptions {state} />
</SectionItem> </SectionItem>
</Section> </Container>

View file

@ -3,12 +3,18 @@ Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
--> -->
<script lang="ts"> <script lang="ts">
import Section from "components/Section.svelte";
export let title: string; export let title: string;
export let api: Record<string, never> | undefined = undefined;
</script> </script>
<div class="container-fluid my-4"> <div class="container-fluid my-4">
<h1>{title}</h1> <h1>{title}</h1>
<slot />
<Section {api}>
<slot />
</Section>
</div> </div>
<style lang="scss"> <style lang="scss">