anki/ts/components/TitledContainer.svelte
Damien Elmes f10a29a93d Make help button more obvious, and remove hover animations
There's been a fair bit of talk on the forums about users not discovering
the help info, so this will hopefully make finding it easier.

Ideally we'd use a single var(--fg), but it feels a bit too strong in
light mode.

The animations we were showing on hover/focus made the UI feel
laggy. This has come up before, and we already disable them for buttons.
I experimented with removing the transitions (but keeping the change on
hover) - it feels much more responsive, but I also didn't feel that it
was contributing anything useful - the user knows where they've placed
the mouse or cursor, and the extra movement feels like a bit of a
distraction. Happy to discuss if people feel differently, though.
2023-12-08 13:39:56 +10:00

73 lines
1.6 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 { pageTheme } from "../sveltelib/theme";
const rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
export let id: string | undefined = undefined;
let className: string = "";
export { className as class };
export let title: string;
</script>
<div
{id}
class="container {className}"
class:light={!$pageTheme.isDark}
class:dark={$pageTheme.isDark}
class:rtl
style:--gutter-block="2px"
style:--container-margin="0"
>
<div class="position-relative">
<h1>{title}</h1>
<div class="help-badge position-absolute" class:rtl>
<slot name="tooltip" />
</div>
</div>
<slot />
</div>
<style lang="scss">
@use "sass/elevation" as *;
.container {
width: 100%;
background: var(--canvas-elevated);
border: 1px solid var(--border-subtle);
border-radius: var(--border-radius-medium, 10px);
&.light {
@include elevation(3);
}
&.dark {
@include elevation(4);
}
padding: 1rem 1.75rem 0.75rem 1.25rem;
&.rtl {
padding: 1rem 1.25rem 0.75rem 1.75rem;
}
page-break-inside: avoid;
}
h1 {
border-bottom: 1px solid var(--border);
}
.help-badge {
right: 0;
bottom: 12px;
color: #555;
&.rtl {
right: unset;
left: 0;
}
}
:global(.night-mode) .help-badge {
color: var(--fg);
}
</style>