Fix various RTL issues (#2172)

* Fix RTL issues in deck browser

* Fix RTL issues in deck options

* Fix QMenu indicator being cutoff in RTL mode
This commit is contained in:
Matthias Metelka 2022-11-02 12:47:07 +01:00 committed by GitHub
parent 2a510fe230
commit 27eff12235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 8 deletions

View file

@ -58,6 +58,26 @@ tr:hover:not(.top-level-drag-row) {
} }
} }
} }
[dir="rtl"] {
.current,
tr:hover:not(.top-level-drag-row) {
td {
background: color(canvas-inset);
&:first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-top-right-radius: prop(border-radius-large);
border-bottom-right-radius: prop(border-radius-large);
}
&:last-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: prop(border-radius-large);
border-bottom-left-radius: prop(border-radius-large);
}
}
}
}
.decktd { .decktd {
min-width: 15em; min-width: 15em;

View file

@ -94,8 +94,8 @@ QMenu::separator {{
}} }}
QMenu::indicator {{ QMenu::indicator {{
border: 1px solid {tm.var(colors.BORDER)}; border: 1px solid {tm.var(colors.BORDER)};
margin-left: 6px; margin-{tm.left()}: 6px;
margin-right: -6px; margin-{tm.right()}: -6px;
}} }}
""" """

View file

@ -8,9 +8,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
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 rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
</script> </script>
<div class="form-check form-switch"> <div class="form-check form-switch" class:rtl>
<input <input
{id} {id}
type="checkbox" type="checkbox"
@ -45,4 +47,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
background-color: var(--canvas-elevated); background-color: var(--canvas-elevated);
border-color: var(--border); border-color: var(--border);
} }
.form-switch.rtl {
padding-left: 0;
padding-right: 0.5em;
.form-check-input {
margin-left: 0;
margin-right: 1.5em;
}
}
</style> </style>

View file

@ -5,6 +5,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<script lang="ts"> <script lang="ts">
import { pageTheme } from "../sveltelib/theme"; import { pageTheme } from "../sveltelib/theme";
const rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
export let id: string | undefined = undefined; export let id: string | undefined = undefined;
let className: string = ""; let className: string = "";
export { className as class }; export { className as class };
@ -17,12 +19,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
class="container {className}" class="container {className}"
class:light={!$pageTheme.isDark} class:light={!$pageTheme.isDark}
class:dark={$pageTheme.isDark} class:dark={$pageTheme.isDark}
class:rtl
style:--gutter-block="2px" style:--gutter-block="2px"
style:--container-margin="0" style:--container-margin="0"
> >
<div class="position-relative"> <div class="position-relative">
<h1>{title}</h1> <h1>{title}</h1>
<div class="help-badge position-absolute"><slot name="tooltip" /></div> <div class="help-badge position-absolute" class:rtl>
<slot name="tooltip" />
</div>
</div> </div>
<slot /> <slot />
</div> </div>
@ -33,6 +38,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
width: 100%; width: 100%;
border-radius: var(--border-radius-large, 10px); border-radius: var(--border-radius-large, 10px);
padding: 1rem 1.75rem 0.75rem 1.25rem; padding: 1rem 1.75rem 0.75rem 1.25rem;
&.rtl {
padding: 1rem 1.25rem 0.75rem 1.75rem;
}
border: var(--border-subtle); border: var(--border-subtle);
&:hover, &:hover,
&:focus-within { &:focus-within {
@ -59,5 +67,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
transition: none; transition: none;
color: var(--fg); color: var(--fg);
} }
&.rtl {
right: unset;
left: 0;
}
} }
</style> </style>

View file

@ -3,6 +3,8 @@
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">
const rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
export let grow = true; export let grow = true;
let width = 0; let width = 0;
</script> </script>
@ -12,7 +14,7 @@
class:flex-grow-1={grow} class:flex-grow-1={grow}
style:--offset="-{width}px" style:--offset="-{width}px"
> >
<div class="revert" bind:clientWidth={width}> <div class="revert" class:rtl bind:clientWidth={width}>
<slot name="revert" /> <slot name="revert" />
</div> </div>
<slot /> <slot />
@ -23,6 +25,10 @@
position: absolute; position: absolute;
right: var(--offset); right: var(--offset);
color: var(--fg-faint); color: var(--fg-faint);
&.rtl {
right: unset;
left: var(--offset);
}
} }
.config-input { .config-input {
&:hover, &:hover,

View file

@ -18,6 +18,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { chevronDown } from "./icons"; import { chevronDown } from "./icons";
import type { DeckOptionsState } from "./lib"; import type { DeckOptionsState } from "./lib";
const rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
export let state: DeckOptionsState; export let state: DeckOptionsState;
@ -67,7 +69,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
primary primary
on:click={() => save(false)} on:click={() => save(false)}
tooltip={getPlatformString(saveKeyCombination)} tooltip={getPlatformString(saveKeyCombination)}
--border-left-radius="var(--border-radius)" --border-left-radius={!rtl ? "var(--border-radius)" : "0"}
--border-right-radius={rtl ? "var(--border-radius)" : "0"}
> >
<div class="save">{tr.deckConfigSaveButton()}</div> <div class="save">{tr.deckConfigSaveButton()}</div>
</LabelButton> </LabelButton>
@ -83,7 +86,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
class="chevron" class="chevron"
slot="reference" slot="reference"
on:click={() => (showFloating = !showFloating)} on:click={() => (showFloating = !showFloating)}
--border-right-radius="var(--border-radius)" --border-right-radius={!rtl ? "var(--border-radius)" : "0"}
--border-left-radius={rtl ? "var(--border-radius)" : "0"}
iconSize={80} iconSize={80}
> >
{@html chevronDown} {@html chevronDown}

View file

@ -56,7 +56,7 @@
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: space-between; justify-content: space-between;
padding-left: 0; padding-inline: 0;
margin-bottom: 0.25rem; margin-bottom: 0.25rem;
list-style: none; list-style: none;
} }