anki/ts/components/StickyContainer.svelte
Matthias Metelka 933ee647bc
Align design of Change Notetype screen with rest of UI (#1522)
* Remove background and border from scrollArea

* Fix 1px of background text showing above template header on scroll

I couldn't figure out the reason for this "clipping" issue. What I tried:
- check HTML structure for any elements that might add extra padding/margin
- remove the 1px border of the header

* Adjust spacing to be more in line with rest of UI
2021-12-04 14:53:16 +10:00

39 lines
1.1 KiB
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import Container from "./Container.svelte";
import type { Breakpoint } from "./types";
export let id: string | undefined = undefined;
let className: string = "";
export { className as class };
export let height: number = 0;
export let breakpoint: Breakpoint | "fluid" = "fluid";
export let api: Record<string, never> | undefined = undefined;
</script>
<div {id} bind:offsetHeight={height} class="sticky-container {className}">
<Container {breakpoint} {api}>
<slot />
</Container>
</div>
<style lang="scss">
.sticky-container {
position: sticky;
top: var(--sticky-top, 0);
bottom: 0;
left: 0;
right: 0;
z-index: 10;
background: var(--sticky-bg, var(--window-bg));
border-style: solid;
border-color: var(--sticky-border, var(--medium-border));
border-width: var(--sticky-borders, 0);
}
</style>