From 84d81417fe65e81e31ad9d79753824112a4d8c14 Mon Sep 17 00:00:00 2001 From: Anna No Date: Tue, 10 Oct 2023 23:34:39 +0700 Subject: [PATCH] Adjust reference input styles (#3816) Signed-off-by: Anna No --- .../src/components/ReferenceInput.svelte | 301 +++++++----------- .../src/components/StyledTextArea.svelte | 4 +- .../src/components/StyledTextBox.svelte | 3 +- .../src/components/StyledTextEditor.svelte | 53 +-- .../src/components/icons/Send.svelte | 12 +- packages/theme/styles/_colors.scss | 12 +- packages/theme/styles/_text-editor.scss | 4 +- .../src/components/AttachmentRefInput.svelte | 52 ++- .../src/components/AttachmentStyledBox.svelte | 4 +- .../src/components/CommentPopup.svelte | 2 +- tests/sanity/tests/workbench.spec.ts | 4 +- 11 files changed, 206 insertions(+), 245 deletions(-) diff --git a/packages/text-editor/src/components/ReferenceInput.svelte b/packages/text-editor/src/components/ReferenceInput.svelte index 754dcdaf94..04c60da67e 100644 --- a/packages/text-editor/src/components/ReferenceInput.svelte +++ b/packages/text-editor/src/components/ReferenceInput.svelte @@ -17,14 +17,13 @@ import { getClient } from '@hcengineering/presentation' import { AnySvelteComponent, + Button, + ButtonKind, EmojiPopup, - Icon, IconEmoji, - Spinner, handler, registerFocus, showPopup, - tooltip, deviceOptionsStore as deviceInfo, checkAdaptiveMatching } from '@hcengineering/ui' @@ -40,18 +39,22 @@ import RIMention from './icons/RIMention.svelte' import Send from './icons/Send.svelte' - const dispatch = createEventDispatcher() export let content: string = '' + export let showHeader = false + export let showActions = true export let showSend = true export let iconSend: Asset | AnySvelteComponent | undefined = undefined export let labelSend: IntlString | undefined = undefined + export let kindSend: ButtonKind = 'ghost' export let haveAttachment = false - export let withoutTopBorder = false export let placeholder: IntlString | undefined = undefined export let extraActions: RefAction[] | undefined = undefined export let loading: boolean = false + export let focusable: boolean = false const client = getClient() + const dispatch = createEventDispatcher() + const buttonSize = 'medium' let textEditor: TextEditor @@ -156,195 +159,131 @@ }) -
-
-
- { - if (!isEmpty || haveAttachment) { - dispatch('message', ev.detail) - content = '' - textEditor.clear() - } - }} - on:blur={() => { - focused = false - dispatch('blur', focused) - }} - on:focus={() => { - focused = true - updateFocus() - dispatch('focus', focused) - }} - extensions={[ - completionPlugin, - EmojiExtension.configure(), - IsEmptyContentExtension.configure({ onChange: (value) => (isEmpty = value) }) - ]} - on:update - placeholder={placeholder ?? textEditorPlugin.string.EditorPlaceholder} - textFormatCategories={[ - TextFormatCategory.TextDecoration, - TextFormatCategory.Link, - TextFormatCategory.List, - TextFormatCategory.Quote, - TextFormatCategory.Code - ]} - /> +
+ {#if showHeader && $$slots.header} +
+
- {#if showSend} - - {/if} + {/if} +
+ { + if (!isEmpty || haveAttachment) { + dispatch('message', ev.detail) + content = '' + textEditor.clear() + } + }} + on:blur={() => { + focused = false + dispatch('blur') + }} + on:focus={() => { + focused = true + updateFocus() + dispatch('focus') + }} + extensions={[ + completionPlugin, + EmojiExtension.configure(), + IsEmptyContentExtension.configure({ onChange: (value) => (isEmpty = value) }) + ]} + on:update + placeholder={placeholder ?? textEditorPlugin.string.EditorPlaceholder} + textFormatCategories={[ + TextFormatCategory.TextDecoration, + TextFormatCategory.Link, + TextFormatCategory.List, + TextFormatCategory.Quote, + TextFormatCategory.Code + ]} + />
-
-
- {#each actions as a} - -
handleAction(a, evt))} - > - + {#if showActions || showSend} +
+ {#if showActions} +
+ {#each actions as a} +
- {/each} -
- {/if} -
+ {/if} + {/if} + + {#if showSend} +
+ {/if}
diff --git a/packages/text-editor/src/components/StyledTextArea.svelte b/packages/text-editor/src/components/StyledTextArea.svelte index 139fb9d594..33cad85a8e 100644 --- a/packages/text-editor/src/components/StyledTextArea.svelte +++ b/packages/text-editor/src/components/StyledTextArea.svelte @@ -1,6 +1,6 @@ - - + + + + diff --git a/packages/theme/styles/_colors.scss b/packages/theme/styles/_colors.scss index 214eea980b..ed8410f319 100644 --- a/packages/theme/styles/_colors.scss +++ b/packages/theme/styles/_colors.scss @@ -87,6 +87,9 @@ /* Dark Theme */ .theme-dark { + --theme-text-primary-color: rgba(255, 255, 255, .8); + --theme-text-placeholder-color: rgba(255, 255, 255, .4); + --accented-button-disabled: rgba(255, 255, 255, .12); --accented-button-disabled-color: rgba(255, 255, 255, .4); --brand-button-disabled: rgba(255, 255, 255, .12); @@ -112,9 +115,8 @@ --theme-button-contrast-disabled-color: rgba(0, 0, 0, .5); --theme-button-contrast-border: rgba(255, 255, 255, .2); - --theme-refinput-color: rgba(255, 255, 255, .03); --theme-refinput-divider: rgba(255, 255, 255, .07); - --theme-refinput-border: rgba(255, 255, 255, .03); + --theme-refinput-border: rgba(255, 255, 255, .1); // Be aware to update defineAlpha() function in colors.ts --theme-bg-color: #1A1A28; @@ -291,6 +293,9 @@ /* Light Theme */ .theme-light { + --theme-text-primary-color: rgba(0, 0, 0, .8); + --theme-text-placeholder-color: rgba(0, 0, 0, .4); + --accented-button-disabled: rgba(0, 0, 0, .12); --accented-button-disabled-color: rgba(0, 0, 0, .4); --brand-button-disabled: rgba(0, 0, 0, .12); @@ -316,9 +321,8 @@ --theme-button-contrast-disabled-color: rgba(255, 255, 255, .5); --theme-button-contrast-border: rgba(0, 0, 0, .2); - --theme-refinput-color: rgba(0, 0, 0, .03); --theme-refinput-divider: rgba(0, 0, 0, .07); - --theme-refinput-border: rgba(0, 0, 0, .03); + --theme-refinput-border: rgba(0, 0, 0, .1); // Be aware to update defineAlpha() function in colors.ts --theme-bg-color: #F1F1F4; diff --git a/packages/theme/styles/_text-editor.scss b/packages/theme/styles/_text-editor.scss index 05a6b23f0d..d77323d4bd 100644 --- a/packages/theme/styles/_text-editor.scss +++ b/packages/theme/styles/_text-editor.scss @@ -9,7 +9,7 @@ .text-editor-view { overflow-y: auto; - color: var(--theme-caption-color); + color: var(--theme-text-primary-color); p:not(:last-child) { margin-block-end: 1em; @@ -23,7 +23,7 @@ p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; - color: var(--theme-halfcontent-color); + color: var(--theme-text-placeholder-color); pointer-events: none; height: 0; } diff --git a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte index a2ff53c831..242ebf2252 100644 --- a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte +++ b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte @@ -276,26 +276,6 @@ on:dragleave={() => {}} on:drop|preventDefault|stopPropagation={fileDrop} > - {#if attachments.size || progress} -
- {#if progress} -
- -
- {/if} - {#each Array.from(attachments.values()) as attachment} -
- { - if (result !== undefined) removeAttachment(attachment) - }} - /> -
- {/each} -
- {/if} 0 || progress} {loading} on:focus on:blur on:message={onMessage} haveAttachment={attachments.size > 0} - withoutTopBorder={attachments.size > 0} on:attach={() => { dispatch('focus') inputFile.click() @@ -316,20 +296,38 @@ on:update={onUpdate} {placeholder} {extraActions} - /> + > +
+ {#if attachments.size || progress} +
+ {#if progress} +
+ +
+ {/if} + {#each Array.from(attachments.values()) as attachment} +
+ { + if (result !== undefined) removeAttachment(attachment) + }} + /> +
+ {/each} +
+ {/if} +
+