Anki/ts/change-notetype/StickyNav.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

61 lines
1.7 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 * as tr from "../lib/ftl";
import Badge from "../components/Badge.svelte";
import Alert from "./Alert.svelte";
import Container from "../components/Container.svelte";
import Row from "../components/Row.svelte";
import Col from "../components/Col.svelte";
import { exclamationIcon } from "./icons";
import { ChangeNotetypeState, MapContext } from "./lib";
import StickyContainer from "../components/StickyContainer.svelte";
export let state: ChangeNotetypeState;
export let ctx: MapContext;
$: info = state.info;
let heading: string =
ctx === MapContext.Field
? tr.changeNotetypeFields()
: tr.changeNotetypeTemplates();
$: unused = $info.unusedItems(ctx);
</script>
<StickyContainer
--sticky-top={ctx === MapContext.Template ? "-1px" : "0"}
--sticky-border="var(--border)"
--sticky-borders="0px 0 1px"
>
<h1>
{heading}
{#if unused.length > 0}
<Badge iconSize={80}>
{@html exclamationIcon}
</Badge>
{/if}
</h1>
{#if unused.length > 0}
<Alert {unused} {ctx} />
{/if}
{#if $info.templates}
<Container --gutter-inline="0.5rem" --gutter-block="0.2rem">
<Row --cols={2}>
<Col --col-size={1}><b>{tr.changeNotetypeCurrent()}</b></Col>
<Col --col-size={1}><b>{tr.changeNotetypeNew()}</b></Col>
</Row>
</Container>
{/if}
</StickyContainer>
<style lang="scss">
h1 {
padding-top: 0.5em;
}
</style>