Use badge to link manual chapter (#2143)

This commit is contained in:
Matthias Metelka 2022-10-26 03:32:18 +02:00 committed by GitHub
parent 264561cd0d
commit cce936c190
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 37 deletions

View file

@ -9,8 +9,6 @@ help-chapter = chapter
# Tooltip for links to the 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

View file

@ -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 { pageTheme } from "../sveltelib/theme";
import HelpSection from "./HelpSection.svelte";
import { infoCircle } from "./icons";
import { infoCircle, manualIcon } from "./icons";
import type { DeckOption } from "./types";
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">
{title}
</h1>
{#if url}
<a class="manual-badge" href={url}>
<Badge
iconSize={120}
tooltip={tr.helpOpenManualChapter({ name: title })}
>
{@html manualIcon}
</Badge>
</a>
{/if}
<button
type="button"
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"
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 class="modal-body">
<Row --cols={4}>
@ -138,21 +139,23 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</div>
<style lang="scss">
.modal-header {
align-items: unset;
flex-wrap: wrap;
}
.chapter-redirect {
width: 100%;
color: var(--fg-subtle);
font-size: small;
}
#nav {
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 {
padding-top: 0.5rem;
background-color: var(--canvas);
color: var(--fg);
border-radius: var(--border-radius-large, 10px);

View file

@ -15,12 +15,7 @@
<Row>
<h2>
{#if section.url}
<a
href={section.url}
title={tr.helpOpenManualChapter({ name: section.title })}
>
{@html section.title}
</a>
{@html section.title}
{:else}
{@html section.title}
{/if}
@ -51,15 +46,6 @@
<style lang="scss">
h2 {
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 {

View file

@ -3,6 +3,7 @@
/// <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 revertIcon } from "bootstrap-icons/icons/arrow-counterclockwise.svg";
export { default as gearIcon } from "bootstrap-icons/icons/gear.svg";