Anki/ts/lib/components/StickyHeader.svelte
RumovZ 9418bd9c7d
Improve and unify web dialog styling (#3167)
* Rework ChangeNotetypePage with existing components

* Use disabled Select instead of LabelButton

* Don't use  button for unclickable arrow

* Rework ImportLogPage with existing components

* Improve deck options styling

* Align spacing in ChangeNotetypePage further

* Use StickyContainer on ImportPage

* Format
2024-05-01 17:49:57 +10:00

53 lines
1.4 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 "@generated/ftl";
import { getPlatformString } from "@tslib/shortcuts";
import LabelButton from "./LabelButton.svelte";
import Shortcut from "./Shortcut.svelte";
import StickyContainer from "./StickyContainer.svelte";
import ButtonToolbar from "./ButtonToolbar.svelte";
export let path: string;
export let onImport: () => void;
const keyCombination = "Control+Enter";
function basename(path: String): String {
return path.split(/[\\/]/).pop()!;
}
</script>
<StickyContainer
--gutter-block="0.5rem"
--gutter-inline="0.25rem"
--sticky-borders="0 0 1px"
breakpoint="sm"
>
<ButtonToolbar class="justify-content-between" wrap={false}>
<div class="filename">{basename(path)}</div>
<LabelButton
primary
tooltip={getPlatformString(keyCombination)}
on:click={onImport}
--border-left-radius="5px"
--border-right-radius="5px"
>
<div class="import">{tr.actionsImport()}</div>
</LabelButton>
<Shortcut {keyCombination} on:action={onImport} />
</ButtonToolbar>
</StickyContainer>
<style lang="scss">
.import {
margin: 0.2rem 0.75rem;
}
.filename {
word-break: break-word;
}
</style>