UI size tweaks (#2184)

* Reduce font size of answer button indicators

* Increase padding of browser rows with ResizeToContents on vertical header

* Remove 0.8 scale factor for dropdown item font-size

* Remove font-size prop entirely from DropdownItem

* Revert "Remove font-size prop entirely from DropdownItem"

This reverts commit bb0a158f96.

* Remove hard-coded Python font sizes

* Move font size and scrollbar into _root-vars.scss

* Revert editor size variable to 1.6

* Fix icon alignment

* Fix checkbox alignment for dropdown items

* Remove unused classes from Tag.svelte

* Revert "Increase padding of browser rows with ResizeToContents on vertical header"

This reverts commit 77bfc854ba.

* Remove option to set font size of browser entries

* Add setting for browser row padding to preferences

* Revert "Add setting for browser row padding to preferences"

This reverts commit 75c59da65a.

* Revert "Remove option to set font size of browser entries"

This reverts commit a543783d8e.
This commit is contained in:
Matthias Metelka 2022-11-23 07:50:15 +01:00 committed by GitHub
parent fdfdd67c3a
commit 365c5e1fb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 41 additions and 33 deletions

View file

@ -63,7 +63,7 @@ button {
.stattxt { .stattxt {
position: absolute; position: absolute;
white-space: nowrap; white-space: nowrap;
font-size: medium; font-size: small;
top: -3px; top: -3px;
left: 50%; left: 50%;
transform: translate(-50%, -100%); transform: translate(-50%, -100%);

View file

@ -413,10 +413,10 @@ class AnkiWebView(QWebEngineView):
button_style = f""" button_style = f"""
button {{ font-family: {family}; }} button {{ font-family: {family}; }}
""" """
font = f"font-size:12px;font-family:{family};" font = f"font-family:{family};"
elif is_mac: elif is_mac:
family = "Helvetica" family = "Helvetica"
font = f'font-size:14px;font-family:"{family}";' font = f'font-family:"{family}";'
button_style = """ button_style = """
button { button {
--canvas: #fff; --canvas: #fff;
@ -432,7 +432,7 @@ button {
""" """
else: else:
family = self.font().family() family = self.font().family()
font = f'font-size:14px;font-family:"{family}", sans-serif;' font = f'font-family:"{family}", sans-serif;'
button_style = """ button_style = """
/* Buttons */ /* Buttons */
button{{ button{{

View file

@ -25,6 +25,8 @@ for line in re.split(r"[;\{\}]|\*\/", open(root_vars_css).read()):
if line.startswith("/*!"): if line.startswith("/*!"):
if "props" in line: if "props" in line:
reached_props = True reached_props = True
elif "rest" in line:
break
else: else:
comment = re.match(r"\/\*!\s*(.*)$", line)[1] comment = re.match(r"\/\*!\s*(.*)$", line)[1]
continue continue

View file

@ -4,6 +4,7 @@
@use "sass:map"; @use "sass:map";
@use "vars" as *; @use "vars" as *;
@use "functions" as *; @use "functions" as *;
@use "scrollbar";
/*! colors */ /*! colors */
:root { :root {
@ -50,3 +51,15 @@
} }
} }
} }
/*! rest */
:root {
font-size: prop(font-size);
body {
overscroll-behavior: none;
&:not(.isMac),
&:not(.isMac) * {
@include scrollbar.custom;
}
}
}

View file

@ -13,6 +13,11 @@
$vars: ( $vars: (
props: ( props: (
font: (
size: (
default: 15px,
),
),
border-radius: ( border-radius: (
default: ( default: (
"Used to round corners of various UI elements", "Used to round corners of various UI elements",
@ -177,8 +182,8 @@ $vars: (
bg: ( bg: (
"Background color of primary button", "Background color of primary button",
( (
light: palette(blue, 4), light: palette(blue, 5),
dark: color.scale(palette(blue, 6), $saturation: -10%), dark: color.scale(palette(blue, 7), $saturation: -10%),
), ),
), ),
gradient: ( gradient: (

View file

@ -1,6 +1,5 @@
@use "vars" as *; @use "vars" as *;
@use "root-vars"; @use "root-vars";
@use "scrollbar";
@use "button-mixins" as button; @use "button-mixins" as button;
$body-color: color(fg); $body-color: color(fg);
@ -43,15 +42,6 @@ html {
overflow-x: hidden; overflow-x: hidden;
} }
body {
--base-font-size: 13px;
overscroll-behavior: none;
&:not(.isMac),
&:not(.isMac) * {
@include scrollbar.custom;
}
}
button { button {
/* override transition for instant hover response */ /* override transition for instant hover response */
transition: color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important; transition: color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;

View file

@ -27,6 +27,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{id} {id}
class="button-toolbar btn-toolbar {className}" class="button-toolbar btn-toolbar {className}"
class:nightMode={$pageTheme.isDark} class:nightMode={$pageTheme.isDark}
style:--icon-align="baseline"
{style} {style}
role="toolbar" role="toolbar"
on:focusout on:focusout

View file

@ -10,6 +10,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<style lang="scss"> <style lang="scss">
label { label {
line-height: 1; line-height: inherit;
} }
</style> </style>

View file

@ -49,7 +49,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
justify-content: start; justify-content: start;
width: 100%; width: 100%;
font-size: var(--dropdown-font-size, calc(0.8 * var(--base-font-size))); font-size: var(--dropdown-font-size, var(--font-size));
background: none; background: none;
box-shadow: none !important; box-shadow: none !important;

View file

@ -47,7 +47,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
@include button.border-radius; @include button.border-radius;
padding: 0 var(--padding-inline, 0); padding: 0 var(--padding-inline, 0);
font-size: var(--base-font-size); font-size: var(--font-size);
height: var(--buttons-size); height: var(--buttons-size);
min-width: calc(var(--buttons-size) * 0.75); min-width: calc(var(--buttons-size) * 0.75);
} }

View file

@ -50,7 +50,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 0 calc(var(--buttons-size) / 3); padding: 0 calc(var(--buttons-size) / 3);
font-size: var(--base-font-size); font-size: var(--font-size);
width: auto; width: auto;
height: var(--buttons-size); height: var(--buttons-size);
} }

View file

@ -68,7 +68,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
.congrats { .congrats {
margin-top: 2em; margin-top: 2em;
max-width: 30em; max-width: 30em;
font-size: var(--base-font-size); font-size: var(--font-size);
:global(a) { :global(a) {
color: var(--fg-link); color: var(--fg-link);

View file

@ -11,7 +11,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</script> </script>
<div class="collapse-badge" class:collapsed class:highlighted> <div class="collapse-badge" class:collapsed class:highlighted>
<Badge iconSize={80} --icon-align="text-bottom">{@html chevronDown}</Badge> <Badge iconSize={80}>{@html chevronDown}</Badge>
</div> </div>
<style lang="scss"> <style lang="scss">

View file

@ -78,7 +78,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
return fontFamily; return fontFamily;
} }
const size = 1.5; const size = 1.6;
const wrap = true; const wrap = true;
const fieldStores: Writable<string>[] = []; const fieldStores: Writable<string>[] = [];
@ -457,6 +457,7 @@ the AddCards dialog) should be implemented in the user of this component.
richTextsHidden[index] = true; richTextsHidden[index] = true;
} }
}} }}
--icon-align="bottom"
> >
<svelte:fragment slot="field-name"> <svelte:fragment slot="field-name">
<LabelName> <LabelName>

View file

@ -27,7 +27,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
</script> </script>
<ButtonGroup size={1.5} wrap={false}> <ButtonGroup size={1.6} wrap={false}>
<IconButton <IconButton
tooltip={tr.editingFloatLeft()} tooltip={tr.editingFloatLeft()}
active={floatStyle === "left"} active={floatStyle === "left"}

View file

@ -22,7 +22,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
</script> </script>
<ButtonGroup size={1.5}> <ButtonGroup size={1.6}>
<IconButton <IconButton
disabled={shrinkingDisabled} disabled={shrinkingDisabled}
flipX={$direction === "rtl"} flipX={$direction === "rtl"}

View file

@ -17,7 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
</script> </script>
<ButtonToolbar size={1.5} wrap={false}> <ButtonToolbar size={1.6} wrap={false}>
<ButtonGroup> <ButtonGroup>
<IconButton <IconButton
tooltip={tr.editingMathjaxInline()} tooltip={tr.editingMathjaxInline()}

View file

@ -5,8 +5,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, onMount } from "svelte"; import { createEventDispatcher, onMount } from "svelte";
import { pageTheme } from "../sveltelib/theme";
let className: string = ""; let className: string = "";
export { className as class }; export { className as class };
@ -29,11 +27,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<button <button
bind:this={button} bind:this={button}
class="tag btn d-inline-flex align-items-center text-nowrap ps-2 pe-1 {className}" class="tag d-inline-flex align-items-center text-nowrap ps-2 pe-1 {className}"
class:selected class:selected
class:flashing class:flashing
class:btn-day={!$pageTheme.isDark}
class:btn-night={$pageTheme.isDark}
tabindex="-1" tabindex="-1"
title={tooltip} title={tooltip}
on:mousemove on:mousemove
@ -60,7 +56,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
.tag { .tag {
@include button.base($with-active: false, $with-disabled: false); @include button.base($with-active: false, $with-disabled: false);
font-size: var(--base-font-size); font-size: var(--font-size);
padding: 0; padding: 0;
--border-color: var(--border); --border-color: var(--border);

View file

@ -267,7 +267,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
resize: none; resize: none;
appearance: none; appearance: none;
font: inherit; font: inherit;
font-size: var(--base-font-size); font-size: var(--font-size);
outline: none; outline: none;
border: none; border: none;
margin: 0; margin: 0;