From f0cca26e9b6305e74dc5d6b4ab0112b3a103d6d9 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Sat, 16 Apr 2022 06:06:32 +0300 Subject: [PATCH] Update TagEditor layout (#1420) Signed-off-by: Alexander Platov --- packages/presentation/lang/en.json | 2 +- packages/presentation/lang/ru.json | 2 +- .../src/components/UserBoxList.svelte | 2 +- packages/theme/styles/_layouts.scss | 2 + packages/theme/styles/popups.scss | 65 +++++- packages/ui/src/components/Icon.svelte | 2 +- .../ui/src/components/PopupInstance.svelte | 4 +- plugins/recruit-assets/lang/en.json | 3 +- plugins/recruit-assets/lang/ru.json | 3 +- .../src/components/CreateApplication.svelte | 30 +-- .../src/components/CreateCandidate.svelte | 41 ++-- .../src/components/YesNo.svelte | 49 +++-- plugins/recruit-resources/src/plugin.ts | 3 +- .../src/components/CategoryBar.svelte | 35 ++-- .../src/components/TagItem.svelte | 9 +- .../tags-resources/src/components/Tags.svelte | 1 + .../src/components/TagsEditor.svelte | 110 +++------- .../src/components/TagsPopup.svelte | 198 +++++++++++++----- .../src/components/TagsView.svelte | 4 +- .../src/components/icons/View.svelte | 25 +++ .../src/components/icons/ViewHide.svelte | 26 +++ tests/sanity/tests/tags.spec.ts | 16 +- 22 files changed, 391 insertions(+), 241 deletions(-) create mode 100644 plugins/tags-resources/src/components/icons/View.svelte create mode 100644 plugins/tags-resources/src/components/icons/ViewHide.svelte diff --git a/packages/presentation/lang/en.json b/packages/presentation/lang/en.json index 69d8aea00f..b56c8ff544 100644 --- a/packages/presentation/lang/en.json +++ b/packages/presentation/lang/en.json @@ -15,6 +15,6 @@ "Search": "Search...", "Unassigned": "Unassigned", "CreateMore": "Create more", - "NumberMembers": "{lenght, plural, =0 {no members} =1 {1 member} other {# members}}" + "NumberMembers": "{count, plural, =0 {no members} =1 {1 member} other {# members}}" } } diff --git a/packages/presentation/lang/ru.json b/packages/presentation/lang/ru.json index 396f6e8235..159c4389c6 100644 --- a/packages/presentation/lang/ru.json +++ b/packages/presentation/lang/ru.json @@ -15,6 +15,6 @@ "Search": "Поиск...", "Unassigned": "Не назначен", "CreateMore": "Создать еще", - "NumberMembers": "{lenght, plural, =0 {нет участников} =1 {1 участик} other {# участника}}" + "NumberMembers": "{count, plural, =0 {нет участников} =1 {1 участик} other {# участника}}" } } diff --git a/packages/presentation/src/components/UserBoxList.svelte b/packages/presentation/src/components/UserBoxList.svelte index b90f5960fd..30a378320c 100644 --- a/packages/presentation/src/components/UserBoxList.svelte +++ b/packages/presentation/src/components/UserBoxList.svelte @@ -79,7 +79,7 @@ {#if persons.length > 0}
- {#await translate(presentation.string.NumberMembers, { lenght: persons.length }) then text} + {#await translate(presentation.string.NumberMembers, { count: persons.length }) then text} {text} {/await}
diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index 145aa44989..1482b17517 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -296,6 +296,7 @@ p:last-child { margin-block-end: 0; } .ml-12 { margin-left: 3rem; } .ml-22 { margin-left: 5.5rem; } .mr-1 { margin-right: .25rem; } +.mr-1-5 { margin-right: .375rem; } .mr-2 { margin-right: .5rem; } .mr-3 { margin-right: .75rem; } .mr-4 { margin-right: 1rem; } @@ -461,6 +462,7 @@ a.no-line { color: var(--theme-content-trans-color); user-select: none; } +.text-xs { font-size: .625rem; } .text-sm { font-size: .75rem; } .text-md { font-size: .8125rem; } .text-lg { font-size: 1.125rem; } diff --git a/packages/theme/styles/popups.scss b/packages/theme/styles/popups.scss index e71146e1a2..a84574f797 100644 --- a/packages/theme/styles/popups.scss +++ b/packages/theme/styles/popups.scss @@ -18,18 +18,20 @@ overflow: hidden; display: flex; flex-direction: column; - width: min-content; + width: fit-content; min-width: 10rem; - max-width: 45rem; - max-height: 20rem; + max-width: 15rem; + max-height: 22rem; background: var(--popup-bg-color); border-radius: .5rem; box-shadow: var(--popup-shadow); will-change: transform; + &.maxHeight { height: 22rem; } .header { border-bottom: 1px solid var(--popup-divider); + &.no-border { border-bottom-color: transparent; } input { margin: 0; padding: .625rem .75rem; @@ -59,25 +61,33 @@ .menu-item { flex-shrink: 0; justify-content: start; - padding: 0 .75rem; - height: 2rem; + padding: .25rem .75rem; + min-height: 2rem; text-align: left; color: var(--caption-color); cursor: pointer; &.high { height: 3rem; } - .icon { + + .icon, .color, .tag { + flex-shrink: 0; margin-right: .75rem; + } + .icon { width: 1rem; height: 1rem; } .color { - margin-right: .75rem; width: .875rem; height: .875rem; border: 1px solid rgba(0, 0, 0, .1); border-radius: .25rem; } + .tag { + width: .5rem; + height: .5rem; + border-radius: 50%; + } .label { flex-grow: 1; min-width: 0; @@ -89,11 +99,50 @@ display: flex; align-items: center; margin-right: .75rem; - height: 2rem; } .check-right { margin: 0 0 0 2rem; } &:hover { background-color: var(--popup-bg-hover); } } + .sticky-wrapper { + display: flex; + flex-direction: column; + + &:not(:first-child) { margin-top: 1px; } + } + .menu-group { + overflow: hidden; + display: flex; + flex-direction: column; + height: 0; + transition: height .5s ease; + + &__header { + position: sticky; + top: 0; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: space-between; + padding: .125rem .25rem; + min-height: 1.5rem; + font-weight: 500; + font-size: .75rem; + text-align: left; + color: var(--accent-color); + background-color: var(--button-bg-color); + cursor: pointer; + + .icon { + width: .25rem; + transform-origin: 40% 50%; + transform: rotate(0deg); + transition: transform .15s cubic-bezier(0.175, 0.885, 0.32, 1.275); + } + &.show .icon { transform: rotate(90deg); } + &:hover { color: var(--caption-color); } + &.show + .menu-group { height: auto; } + } + } } .antiPopup { diff --git a/packages/ui/src/components/Icon.svelte b/packages/ui/src/components/Icon.svelte index 40b9e3f8ba..310dd0f8cc 100644 --- a/packages/ui/src/components/Icon.svelte +++ b/packages/ui/src/components/Icon.svelte @@ -17,7 +17,7 @@ import { AnySvelteComponent } from '../types' export let icon: Asset | AnySvelteComponent - export let size: 'x-small' | 'small' | 'medium' | 'large' | 'full' + export let size: 'inline' | 'x-small' | 'small' | 'medium' | 'large' | 'full' export let fill = 'currentColor' export let filled: boolean = false diff --git a/packages/ui/src/components/PopupInstance.svelte b/packages/ui/src/components/PopupInstance.svelte index 8a6d57d500..915ff52259 100644 --- a/packages/ui/src/components/PopupInstance.svelte +++ b/packages/ui/src/components/PopupInstance.svelte @@ -31,6 +31,7 @@ let modalHTML: HTMLElement let componentInstance: any let show: boolean = false + let height: number function _update (result: any): void { if (onUpdate !== undefined) onUpdate(result) @@ -61,11 +62,12 @@ } } afterUpdate(() => fitPopup()) + $: if (height) fitPopup() -