mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Remove use of bootstrap-dark.night-mode for deckoptions
The CSS for the Switch component had a conflict regarding background color Also generally it makes sense to put the CSS into the components
This commit is contained in:
parent
e8a6add60b
commit
e5978d7ffe
7 changed files with 84 additions and 7 deletions
|
@ -12,15 +12,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
const nightMode = getContext<boolean>(nightModeKey);
|
const nightMode = getContext<boolean>(nightModeKey);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<select bind:value class:visible-down-arrow={nightMode} class="form-select">
|
<select
|
||||||
|
bind:value
|
||||||
|
class:nightMode
|
||||||
|
class:visible-down-arrow={nightMode}
|
||||||
|
class="form-select"
|
||||||
|
>
|
||||||
{#each choices as choice, idx}
|
{#each choices as choice, idx}
|
||||||
<option value={idx}>{choice}</option>
|
<option value={idx}>{choice}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@use "ts/sass/night-mode" as nightmode;
|
||||||
@use "ts/sass/button_mixins" as button;
|
@use "ts/sass/button_mixins" as button;
|
||||||
|
|
||||||
|
.nightMode {
|
||||||
|
@include nightmode.input;
|
||||||
|
}
|
||||||
|
|
||||||
.visible-down-arrow {
|
.visible-down-arrow {
|
||||||
/* override the default down arrow */
|
/* override the default down arrow */
|
||||||
background-image: button.down-arrow(white);
|
background-image: button.down-arrow(white);
|
||||||
|
|
|
@ -3,10 +3,15 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
import { nightModeKey } from "components/contextKeys";
|
||||||
|
|
||||||
export let value: number;
|
export let value: number;
|
||||||
export let min = 1;
|
export let min = 1;
|
||||||
export let max = 9999;
|
export let max = 9999;
|
||||||
|
|
||||||
|
const nightMode = getContext<boolean>(nightModeKey);
|
||||||
|
|
||||||
function checkMinMax() {
|
function checkMinMax() {
|
||||||
if (value > max) {
|
if (value > max) {
|
||||||
value = max;
|
value = max;
|
||||||
|
@ -24,5 +29,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
{max}
|
{max}
|
||||||
bind:value
|
bind:value
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
class:nightMode
|
||||||
on:blur={checkMinMax}
|
on:blur={checkMinMax}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@use "ts/sass/night-mode" as nightmode;
|
||||||
|
|
||||||
|
.nightMode {
|
||||||
|
@include nightmode.input;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -3,6 +3,9 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
import { nightModeKey } from "components/contextKeys";
|
||||||
|
|
||||||
export let value: number;
|
export let value: number;
|
||||||
export let min = 1;
|
export let min = 1;
|
||||||
export let max = 9999;
|
export let max = 9999;
|
||||||
|
@ -10,6 +13,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
let stringValue: string;
|
let stringValue: string;
|
||||||
$: stringValue = value.toFixed(2);
|
$: stringValue = value.toFixed(2);
|
||||||
|
|
||||||
|
const nightMode = getContext<boolean>(nightModeKey);
|
||||||
|
|
||||||
function update(this: HTMLInputElement): void {
|
function update(this: HTMLInputElement): void {
|
||||||
value = Math.min(max, Math.max(min, parseFloat(this.value)));
|
value = Math.min(max, Math.max(min, parseFloat(this.value)));
|
||||||
}
|
}
|
||||||
|
@ -20,9 +25,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
pattern="[0-9]*"
|
pattern="[0-9]*"
|
||||||
inputmode="decimal"
|
inputmode="decimal"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
class:nightMode
|
||||||
{min}
|
{min}
|
||||||
{max}
|
{max}
|
||||||
step="0.01"
|
step="0.01"
|
||||||
value={stringValue}
|
value={stringValue}
|
||||||
on:blur={update}
|
on:blur={update}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@use "ts/sass/night-mode" as nightmode;
|
||||||
|
|
||||||
|
.nightMode {
|
||||||
|
@include nightmode.input;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -3,6 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
import { nightModeKey } from "components/contextKeys";
|
||||||
import { stepsToString, stringToSteps } from "./steps";
|
import { stepsToString, stringToSteps } from "./steps";
|
||||||
|
|
||||||
export let value: number[];
|
export let value: number[];
|
||||||
|
@ -10,9 +12,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
let stringValue: string;
|
let stringValue: string;
|
||||||
$: stringValue = stepsToString(value);
|
$: stringValue = stepsToString(value);
|
||||||
|
|
||||||
|
const nightMode = getContext<boolean>(nightModeKey);
|
||||||
|
|
||||||
function update(this: HTMLInputElement): void {
|
function update(this: HTMLInputElement): void {
|
||||||
value = stringToSteps(this.value);
|
value = stringToSteps(this.value);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input type="text" value={stringValue} on:blur={update} class="form-control" />
|
<input
|
||||||
|
type="text"
|
||||||
|
value={stringValue}
|
||||||
|
class="form-control"
|
||||||
|
class:nightMode
|
||||||
|
on:blur={update}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@use "ts/sass/night-mode" as nightmode;
|
||||||
|
|
||||||
|
.nightMode {
|
||||||
|
@include nightmode.input;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -3,16 +3,22 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
import { nightModeKey } from "components/contextKeys";
|
||||||
|
|
||||||
export let id: string | undefined;
|
export let id: string | undefined;
|
||||||
export let value: boolean;
|
export let value: boolean;
|
||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
|
|
||||||
|
const nightMode = getContext<boolean>(nightModeKey);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input
|
<input
|
||||||
{id}
|
{id}
|
||||||
class="form-check-input"
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
class="form-check-input"
|
||||||
|
class:nightMode
|
||||||
bind:checked={value}
|
bind:checked={value}
|
||||||
{disabled}
|
{disabled}
|
||||||
/>
|
/>
|
||||||
|
@ -20,10 +26,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.form-switch {
|
.form-switch {
|
||||||
// bootstrap adds a default 2.5em left pad, which causes
|
/* bootstrap adds a default 2.5em left pad, which causes */
|
||||||
// text to wrap prematurely
|
/* text to wrap prematurely */
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-check-input {
|
.form-check-input {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
height: 1.6em;
|
height: 1.6em;
|
||||||
|
@ -35,4 +42,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
margin-left: 1.5em;
|
margin-left: 1.5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nightMode {
|
||||||
|
background-color: var(--frame-bg);
|
||||||
|
border-color: var(--border);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -4,7 +4,6 @@ $tooltip-max-width: 300px;
|
||||||
|
|
||||||
@use "ts/sass/vars";
|
@use "ts/sass/vars";
|
||||||
@use "ts/sass/scrollbar";
|
@use "ts/sass/scrollbar";
|
||||||
@use "ts/sass/bootstrap-dark";
|
|
||||||
|
|
||||||
@import "ts/sass/base";
|
@import "ts/sass/base";
|
||||||
@import "ts/sass/bootstrap/containers";
|
@import "ts/sass/bootstrap/containers";
|
||||||
|
@ -22,7 +21,6 @@ $tooltip-max-width: 300px;
|
||||||
|
|
||||||
.night-mode {
|
.night-mode {
|
||||||
@include scrollbar.night-mode;
|
@include scrollbar.night-mode;
|
||||||
@include bootstrap-dark.night-mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control,
|
.form-control,
|
||||||
|
|
11
ts/sass/night-mode.scss
Normal file
11
ts/sass/night-mode.scss
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* Copyright: Ankitects Pty Ltd and contributors
|
||||||
|
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
|
||||||
|
|
||||||
|
@mixin input {
|
||||||
|
background-color: var(--frame-bg);
|
||||||
|
border-color: var(--border);
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
background-color: var(--window-bg);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue