From 3043789960d5b348a5b72f776ee90883a7b90047 Mon Sep 17 00:00:00 2001 From: Matthias Metelka <62722460+kleinerpirat@users.noreply.github.com> Date: Wed, 3 Aug 2022 17:47:53 +0200 Subject: [PATCH] Redesign fields --- ts/editor/EditingArea.svelte | 20 ++++- ts/editor/EditorField.svelte | 24 +----- ts/editor/FieldState.svelte | 1 - ts/editor/LabelContainer.svelte | 46 +++++++++-- ts/editor/NoteEditor.svelte | 54 ++++++++----- ts/editor/PlainTextBadge.svelte | 80 ++++++++++++++----- ts/editor/RichTextBadge.svelte | 2 +- ts/editor/StickyBadge.svelte | 24 ++++-- .../plain-text-input/PlainTextInput.svelte | 7 +- .../rich-text-input/RichTextInput.svelte | 1 + 10 files changed, 176 insertions(+), 83 deletions(-) diff --git a/ts/editor/EditingArea.svelte b/ts/editor/EditingArea.svelte index 8aa156bed..401611501 100644 --- a/ts/editor/EditingArea.svelte +++ b/ts/editor/EditingArea.svelte @@ -189,10 +189,26 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html position: relative; background: var(--frame-bg); - border-radius: 0 0 5px 5px; + border-radius: 5px; + border: 1px solid var(--border); - &:focus { + box-shadow: 0px 0px 2px 0px var(--border); + transition: box-shadow 80ms cubic-bezier(0.33, 1, 0.68, 1); + + &:focus-within { outline: none; + border-color: var(--focus-border); + &::after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + pointer-events: none; + border-radius: 5px; + box-shadow: inset 0 0 0 1px var(--focus-border); + } } } diff --git a/ts/editor/EditorField.svelte b/ts/editor/EditorField.svelte index 29788cbbf..262f73027 100644 --- a/ts/editor/EditorField.svelte +++ b/ts/editor/EditorField.svelte @@ -48,9 +48,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { promiseWithResolver } from "../lib/promise"; import type { Destroyable } from "./destroyable"; import EditingArea from "./EditingArea.svelte"; - import FieldState from "./FieldState.svelte"; - import LabelContainer from "./LabelContainer.svelte"; - import LabelName from "./LabelName.svelte"; export let content: Writable; export let field: FieldData; @@ -90,14 +87,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html on:focusout on:click={() => editingArea.focus?.()} > - - - - {field.name} - - - - + + .editor-field { + position: relative; --border-color: var(--border); - - border-radius: 5px; - border: 1px solid var(--border-color); - - &:focus-within { - --border-color: var(--focus-border); - - outline: none; - box-shadow: 0 0 0 3px var(--focus-shadow); - } } diff --git a/ts/editor/FieldState.svelte b/ts/editor/FieldState.svelte index f41ed793a..ba7272ea5 100644 --- a/ts/editor/FieldState.svelte +++ b/ts/editor/FieldState.svelte @@ -11,7 +11,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html display: flex; justify-content: flex; flex-grow: 1; - & > :global(*) { margin-left: 2px; } diff --git a/ts/editor/LabelContainer.svelte b/ts/editor/LabelContainer.svelte index 770e0a9fc..1a86f4324 100644 --- a/ts/editor/LabelContainer.svelte +++ b/ts/editor/LabelContainer.svelte @@ -3,35 +3,67 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -->
+ + + {@html icon} + + + +
diff --git a/ts/editor/RichTextBadge.svelte b/ts/editor/RichTextBadge.svelte index f54c6ac35..9ab630623 100644 --- a/ts/editor/RichTextBadge.svelte +++ b/ts/editor/RichTextBadge.svelte @@ -24,7 +24,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {@html icon}{@html icon} diff --git a/ts/editor/StickyBadge.svelte b/ts/editor/StickyBadge.svelte index 0b264c6c8..ba4b0a94e 100644 --- a/ts/editor/StickyBadge.svelte +++ b/ts/editor/StickyBadge.svelte @@ -10,12 +10,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import * as tr from "../lib/ftl"; import { getPlatformString, registerShortcut } from "../lib/shortcuts"; import { context as editorFieldContext } from "./EditorField.svelte"; - import { stickyOff, stickyOn } from "./icons"; + import { stickyIcon } from "./icons"; export let active: boolean; - $: icon = active ? stickyOn : stickyOff; - const editorField = editorFieldContext.get(); const keyCombination = "F9"; @@ -38,19 +36,31 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {@html icon}{@html stickyIcon} diff --git a/ts/editor/plain-text-input/PlainTextInput.svelte b/ts/editor/plain-text-input/PlainTextInput.svelte index 4a28b7185..9b451c596 100644 --- a/ts/editor/plain-text-input/PlainTextInput.svelte +++ b/ts/editor/plain-text-input/PlainTextInput.svelte @@ -164,7 +164,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } :global(.CodeMirror-lines) { - padding: 6px 0; + padding: 8px 0; } &.hidden { @@ -172,7 +172,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } } - .light-theme :global(.CodeMirror) { - border-top: 1px solid #ddd; + :global(.CodeMirror) { + border-top: 1px solid var(--border); + background: var(--code-bg); } diff --git a/ts/editor/rich-text-input/RichTextInput.svelte b/ts/editor/rich-text-input/RichTextInput.svelte index 27cbb9ade..e1af711e3 100644 --- a/ts/editor/rich-text-input/RichTextInput.svelte +++ b/ts/editor/rich-text-input/RichTextInput.svelte @@ -238,6 +238,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/await} +