mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Use badge to link manual chapter (#2143)
This commit is contained in:
parent
264561cd0d
commit
cce936c190
4 changed files with 25 additions and 37 deletions
|
@ -9,8 +9,6 @@ help-chapter = chapter
|
||||||
|
|
||||||
# Tooltip for links to the manual
|
# Tooltip for links to the manual
|
||||||
help-open-manual-chapter = Open chapter { $name } in Anki manual
|
help-open-manual-chapter = Open chapter { $name } in Anki manual
|
||||||
# Displayed underneath chapter title
|
|
||||||
help-view-chapter-in-manual = View the { $chapter } on this topic in the official manual.
|
|
||||||
|
|
||||||
## Body
|
## Body
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import * as tr from "../lib/ftl";
|
import * as tr from "../lib/ftl";
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
import HelpSection from "./HelpSection.svelte";
|
import HelpSection from "./HelpSection.svelte";
|
||||||
import { infoCircle } from "./icons";
|
import { infoCircle, manualIcon } from "./icons";
|
||||||
import type { DeckOption } from "./types";
|
import type { DeckOption } from "./types";
|
||||||
|
|
||||||
export let title: string;
|
export let title: string;
|
||||||
|
@ -69,6 +69,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<h1 class="modal-title" id="modalLabel">
|
<h1 class="modal-title" id="modalLabel">
|
||||||
{title}
|
{title}
|
||||||
</h1>
|
</h1>
|
||||||
|
{#if url}
|
||||||
|
<a class="manual-badge" href={url}>
|
||||||
|
<Badge
|
||||||
|
iconSize={120}
|
||||||
|
tooltip={tr.helpOpenManualChapter({ name: title })}
|
||||||
|
>
|
||||||
|
{@html manualIcon}
|
||||||
|
</Badge>
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn-close"
|
class="btn-close"
|
||||||
|
@ -76,15 +86,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
data-bs-dismiss="modal"
|
data-bs-dismiss="modal"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
/>
|
/>
|
||||||
{#if url}
|
|
||||||
<div class="chapter-redirect">
|
|
||||||
{@html tr.helpViewChapterInManual({
|
|
||||||
chapter: `<a href="${url}" title="${tr.helpOpenManualChapter(
|
|
||||||
{ name: title },
|
|
||||||
)}">${tr.helpChapter()}</a>`,
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<Row --cols={4}>
|
<Row --cols={4}>
|
||||||
|
@ -138,21 +139,23 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.modal-header {
|
|
||||||
align-items: unset;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.chapter-redirect {
|
|
||||||
width: 100%;
|
|
||||||
color: var(--fg-subtle);
|
|
||||||
font-size: small;
|
|
||||||
}
|
|
||||||
#nav {
|
#nav {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-title {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.manual-badge {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--fg-subtle);
|
||||||
|
&:hover {
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
padding-top: 0.5rem;
|
|
||||||
background-color: var(--canvas);
|
background-color: var(--canvas);
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
border-radius: var(--border-radius-large, 10px);
|
border-radius: var(--border-radius-large, 10px);
|
||||||
|
|
|
@ -15,12 +15,7 @@
|
||||||
<Row>
|
<Row>
|
||||||
<h2>
|
<h2>
|
||||||
{#if section.url}
|
{#if section.url}
|
||||||
<a
|
{@html section.title}
|
||||||
href={section.url}
|
|
||||||
title={tr.helpOpenManualChapter({ name: section.title })}
|
|
||||||
>
|
|
||||||
{@html section.title}
|
|
||||||
</a>
|
|
||||||
{:else}
|
{:else}
|
||||||
{@html section.title}
|
{@html section.title}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -51,15 +46,6 @@
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
h2 {
|
h2 {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
a {
|
|
||||||
cursor: pointer;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
text-decoration: none;
|
|
||||||
color: var(--fg);
|
|
||||||
&:hover {
|
|
||||||
border-color: var(--fg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-redirect {
|
.chapter-redirect {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
/// <reference types="../lib/image-import" />
|
/// <reference types="../lib/image-import" />
|
||||||
|
|
||||||
|
export { default as manualIcon } from "@mdi/svg/svg/book-open-variant.svg";
|
||||||
export { default as chevronDown } from "@mdi/svg/svg/chevron-down.svg";
|
export { default as chevronDown } from "@mdi/svg/svg/chevron-down.svg";
|
||||||
export { default as revertIcon } from "bootstrap-icons/icons/arrow-counterclockwise.svg";
|
export { default as revertIcon } from "bootstrap-icons/icons/arrow-counterclockwise.svg";
|
||||||
export { default as gearIcon } from "bootstrap-icons/icons/gear.svg";
|
export { default as gearIcon } from "bootstrap-icons/icons/gear.svg";
|
||||||
|
|
Loading…
Reference in a new issue