anki/ts/change-notetype/StickyHeader.svelte
Henrik Giesel 30bbbaf00b
Use eslint for sorting our imports (#1637)
* Make eslint sort our imports

* fix missing deps in eslint rule (dae)

Caught on Linux due to the stricter sandboxing

* Remove exports-last eslint rule (for now?)

* Adjust browserslist settings

- We use ResizeObserver which is not supported in browsers like KaiOS,
  Baidu or Android UC

* Raise minimum iOS version 13.4

- It's the first version that supports ResizeObserver

* Apply new eslint rules to sort imports
2022-02-04 18:36:34 +10:00

62 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 Badge from "../components/Badge.svelte";
import Col from "../components/Col.svelte";
import Container from "../components/Container.svelte";
import Row from "../components/Row.svelte";
import StickyContainer from "../components/StickyContainer.svelte";
import * as tr from "../lib/ftl";
import Alert from "./Alert.svelte";
import { exclamationIcon } from "./icons";
import { ChangeNotetypeState, MapContext } from "./lib";
export let state: ChangeNotetypeState;
export let ctx: MapContext;
$: info = state.info;
const 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>