mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Add Tag.svelte
This commit is contained in:
parent
f9b320e105
commit
0e858d87d4
4 changed files with 39 additions and 1 deletions
|
@ -103,6 +103,9 @@ copy_bootstrap_icons(
|
||||||
"text-center.svg",
|
"text-center.svg",
|
||||||
"text-indent-left.svg",
|
"text-indent-left.svg",
|
||||||
"text-indent-right.svg",
|
"text-indent-right.svg",
|
||||||
|
|
||||||
|
# tag editor
|
||||||
|
"x.svg",
|
||||||
],
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
30
ts/editor/Tag.svelte
Normal file
30
ts/editor/Tag.svelte
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<!--
|
||||||
|
Copyright: Ankitects Pty Ltd and contributors
|
||||||
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
-->
|
||||||
|
<script lang="typescript">
|
||||||
|
import { deleteIcon } from "./icons";
|
||||||
|
|
||||||
|
let active = false;
|
||||||
|
|
||||||
|
function activate(): void {
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if active}
|
||||||
|
<span>active!</span>
|
||||||
|
{:else}
|
||||||
|
<span class="tag text-nowrap bg-secondary rounded p-1 me-2" on:click={activate}>
|
||||||
|
<slot />
|
||||||
|
{@html deleteIcon}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.tag {
|
||||||
|
/* important for tags with non-latin characters */
|
||||||
|
line-height: 2ch;
|
||||||
|
vertical-align: -webkit-baseline-middle;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -4,8 +4,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import StickyBottom from "components/StickyBottom.svelte";
|
import StickyBottom from "components/StickyBottom.svelte";
|
||||||
|
import Tag from "./Tag.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<StickyBottom>
|
<StickyBottom>
|
||||||
<span>Tags</span>
|
<span>Tags:</span>
|
||||||
|
<Tag>en::foobar</Tag>
|
||||||
|
<Tag>zh::あちこ</Tag>
|
||||||
</StickyBottom>
|
</StickyBottom>
|
||||||
|
|
|
@ -31,6 +31,8 @@ export { default as ellipseIcon } from "./contain.svg";
|
||||||
export { default as functionIcon } from "./function-variant.svg";
|
export { default as functionIcon } from "./function-variant.svg";
|
||||||
export { default as xmlIcon } from "./xml.svg";
|
export { default as xmlIcon } from "./xml.svg";
|
||||||
|
|
||||||
|
export { default as deleteIcon } from "./x.svg";
|
||||||
|
|
||||||
export const arrowIcon =
|
export const arrowIcon =
|
||||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="transparent" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2 5l6 6 6-6"/></svg>';
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="transparent" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2 5l6 6 6-6"/></svg>';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue