From 6df202f1660f9812780f62732bed2d5ac1d491d4 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Wed, 20 Apr 2022 10:56:45 +0300 Subject: [PATCH] Add ChannelsDropdown (#1459) Signed-off-by: Alexander Platov --- packages/theme/styles/_layouts.scss | 1 + packages/theme/styles/popups.scss | 32 ++- packages/ui/src/components/Button.svelte | 7 + packages/ui/src/components/Menu.svelte | 11 +- .../src/components/ChannelEditor.svelte | 60 ++++++ .../src/components/ChannelsDropdown.svelte | 184 ++++++++++++++++++ .../src/components/CreatePerson.svelte | 24 +-- plugins/contact-resources/src/index.ts | 3 +- .../src/components/TagsPopup.svelte | 23 --- 9 files changed, 299 insertions(+), 46 deletions(-) create mode 100644 plugins/contact-resources/src/components/ChannelEditor.svelte create mode 100644 plugins/contact-resources/src/components/ChannelsDropdown.svelte diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index 6d0c377d60..d9c26680c5 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -49,6 +49,7 @@ input { background-color: transparent; outline: none; color: var(--caption-color); + &::placeholder { color: var(--dark-color); } &.wrong-input { background-color: var(--system-error-color) !important; } } audio, canvas, embed, iframe, img, object, svg, video { diff --git a/packages/theme/styles/popups.scss b/packages/theme/styles/popups.scss index bb44f6e7a8..657e07c819 100644 --- a/packages/theme/styles/popups.scss +++ b/packages/theme/styles/popups.scss @@ -42,8 +42,29 @@ color: #d6d6d6; border: none; caret-color: var(--caret-color); - - &::placeholder { color: var(--content-color); } + } + .clear-btn { + display: flex; + justify-content: center; + align-items: center; + width: .75rem; + height: .75rem; + border-radius: 50%; + + .icon { + width: .625rem; + height: .625rem; + } + + &.show { + color: var(--content-color); + background-color: var(--button-border-color); + cursor: pointer; + &:hover { + color: var(--accent-color); + background-color: var(--button-border-hover); + } + } } } @@ -80,6 +101,7 @@ .icon { width: 1rem; height: 1rem; + color: var(--content-color); } .color { width: .875rem; @@ -105,7 +127,11 @@ margin-right: .75rem; } .check-right { margin: 0 0 0 2rem; } - &:hover { background-color: var(--popup-bg-hover); } + &:hover { + background-color: var(--popup-bg-hover); + + .icon { color: var(--accent-color); } + } } .sticky-wrapper { display: flex; diff --git a/packages/ui/src/components/Button.svelte b/packages/ui/src/components/Button.svelte index 1c7acd3209..991bb839e9 100644 --- a/packages/ui/src/components/Button.svelte +++ b/packages/ui/src/components/Button.svelte @@ -32,6 +32,7 @@ export let width: string | undefined = undefined export let resetIconSize: boolean = false export let focus: boolean = false + export let click: boolean = false export let title: string | undefined = undefined export let input: HTMLButtonElement | undefined = undefined @@ -43,6 +44,10 @@ input.focus() focus = false } + if (click && input) { + input.click() + click = false + } }) @@ -128,6 +133,8 @@ &:disabled { color: rgb(var(--caption-color) / 40%); cursor: not-allowed; + + .btn-icon { opacity: .5; } } &.jf-left { justify-content: flex-start; } diff --git a/packages/ui/src/components/Menu.svelte b/packages/ui/src/components/Menu.svelte index f900464875..069326ffd1 100644 --- a/packages/ui/src/components/Menu.svelte +++ b/packages/ui/src/components/Menu.svelte @@ -39,14 +39,14 @@ {/if} {#each actions as action}
{ dispatch('close') action.action(evt, ctx) }} > {#if action.icon} - +
{/if}
@@ -55,3 +55,10 @@
+ + diff --git a/plugins/contact-resources/src/components/ChannelEditor.svelte b/plugins/contact-resources/src/components/ChannelEditor.svelte new file mode 100644 index 0000000000..94a145e17d --- /dev/null +++ b/plugins/contact-resources/src/components/ChannelEditor.svelte @@ -0,0 +1,60 @@ + + + +
+
+
+
+ { + if (ev.key === 'Enter') dispatch('close', value) + }} + on:change + /> +
+
+
{ + value = '' + input.focus() + }}> + {#if value !== ''}
{/if} +
+
+
+
+
diff --git a/plugins/contact-resources/src/components/ChannelsDropdown.svelte b/plugins/contact-resources/src/components/ChannelsDropdown.svelte new file mode 100644 index 0000000000..04bc119f30 --- /dev/null +++ b/plugins/contact-resources/src/components/ChannelsDropdown.svelte @@ -0,0 +1,184 @@ + + + +{#each displayItems as item, i} + {#if item.value === ''} +