Skip to content

Commit

Permalink
TSK-1324: update kanban layout (#3118)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Platov <sas_lord@mail.ru>
  • Loading branch information
SasLord authored May 2, 2023
1 parent d937a80 commit 439f4bb
Show file tree
Hide file tree
Showing 25 changed files with 365 additions and 188 deletions.
29 changes: 7 additions & 22 deletions packages/kanban/src/components/Kanban.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
{@const stateObjects = getGroupByValues(groupByDocs, state)}

<div
class="panel-container step-lr75"
class="panel-container"
bind:this={stateRefs[si]}
on:dragover={(event) => panelDragOver(event, state)}
on:drop={() => {
Expand All @@ -318,9 +318,9 @@
}}
>
{#if $$slots.header !== undefined}
<slot name="header" state={toAny(state)} count={stateObjects.length} />
<slot name="header" state={toAny(state)} count={stateObjects.length} index={si} />
{/if}
<Scroller padding={'.5rem 0'} on:dragover on:drop>
<Scroller padding={'.25rem .5rem'} on:dragover on:drop>
<slot name="beforeCard" {state} />
<KanbanRow
bind:this={stateRows[si]}
Expand Down Expand Up @@ -361,10 +361,13 @@
position: relative;
width: 100%;
height: 100%;
min-width: 0;
min-height: 0;
}
.kanban-content {
display: flex;
padding: 1.5rem 2rem 0;
padding: 1.5rem;
min-width: 0;
}
@keyframes anim-border {
Expand All @@ -384,23 +387,5 @@
background-color: transparent;
border: 1px solid transparent;
border-radius: 0.25rem;
.header {
display: flex;
flex-direction: column;
height: 4rem;
min-height: 4rem;
.bar {
height: 0.375rem;
border-radius: 0.25rem;
}
.label {
padding: 0 0.5rem 0 1rem;
height: 100%;
font-weight: 500;
color: var(--caption-color);
}
}
}
</style>
18 changes: 8 additions & 10 deletions packages/kanban/src/components/KanbanRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div
bind:this={stateRefs[i]}
transition:slideD|local={{ isDragging }}
class="step-tb75"
class="p-1 flex-no-shrink clear-mins"
on:dragover|preventDefault={(evt) => cardDragOver(evt, object)}
on:drop|preventDefault={(evt) => cardDrop(evt, object)}
>
Expand All @@ -107,14 +107,12 @@
</div>
{/each}
{#if stateObjects.length > limitedObjects.length}
<div class="step-tb75">
<div class="p-1 flex-no-shrink clear-mins">
{#if loading}
<Spinner />
{:else}
<div class="card-container h-18 flex-row-center flex-between p-4">
<span class="p-1">
{limitedObjects.length}/{stateObjects.length}
</span>
<div class="card-container flex-between p-4">
<span class="caption-color">{limitedObjects.length}</span> / {stateObjects.length}
<Button
size={'small'}
icon={IconMoreH}
Expand All @@ -140,15 +138,15 @@
// }
&.checked {
background-color: var(--highlight-select);
box-shadow: inset 0 0 1px 1px var(--highlight-select-border);
box-shadow: 0 0 1px 1px var(--highlight-select-border);
&:hover {
background-color: var(--highlight-select-hover);
}
}
&.selection,
&.checked.selection {
box-shadow: inset 0 0 1px 1px var(--primary-button-enabled);
box-shadow: 0 0 1px 1px var(--primary-button-enabled);
animation: anim-border 1s ease-in-out;
&:hover {
Expand All @@ -168,10 +166,10 @@
}
@keyframes anim-border {
from {
box-shadow: inset 0 0 1px 1px var(--primary-edit-border-color);
box-shadow: 0 0 1px 1px var(--primary-edit-border-color);
}
to {
box-shadow: inset 0 0 1px 1px var(--primary-bg-color);
box-shadow: 0 0 1px 1px var(--primary-bg-color);
}
}
</style>
12 changes: 9 additions & 3 deletions packages/theme/styles/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
--theme-list-subheader-color: #262634;
--theme-list-row-color: #21212F;
--theme-list-button-color: #262633;
--theme-list-button-hover: #2F2F3A;
--theme-list-divider-color: rgba(255, 255, 255, .09);
--theme-list-subheader-divider: transparent;

Expand All @@ -107,8 +108,10 @@

--theme-kanban-card-bg-color: rgba(222, 222, 240, .04);
--theme-kanban-card-border: transparent;
--theme-kanban-card-footer: #D9D9D9;

--theme-kanban-card-footer: rgba(217, 217, 217, .07);
--theme-kanban-button-color: #262634;
--theme-kanban-button-hover: #2F2F3B;

--theme-tablist-color: rgba(0, 0, 0, .02);
--theme-checkbox-color: #000;
--theme-checkbox-bg-color: #FFF;
Expand Down Expand Up @@ -254,6 +257,7 @@
--theme-list-subheader-color: #EEEEF0;
--theme-list-row-color: #F7F7F8;
--theme-list-button-color: #F2F2F4;
--theme-list-button-hover: #E8E8EA;
--theme-list-divider-color: rgba(0, 0, 0, .07);
--theme-list-subheader-divider: rgba(0, 0, 0, .06);

Expand All @@ -264,7 +268,9 @@
--theme-kanban-card-bg-color: rgba(0, 0, 0, .03);
--theme-kanban-card-border: rgba(0, 0, 0, .04);
--theme-kanban-card-footer: rgba(0, 0, 0, .04);

--theme-kanban-button-color: #E5E5E7;
--theme-kanban-button-hover: #DCDCDE;

--theme-tablist-color: rgba(0, 0, 0, .02);
--theme-checkbox-color: #000;
--theme-checkbox-bg-color: #FFF;
Expand Down
12 changes: 9 additions & 3 deletions packages/theme/styles/_layouts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ input.search {
&:not(.reverse) > *:not(:first-child) { margin-left: .5rem; }
&.reverse > *:not(:last-child) { margin-right: .5rem; }
}
.gap-3 {
&:not(.reverse) > *:not(:first-child) { margin-left: .75rem; }
&.reverse > *:not(:last-child) { margin-right: .75rem; }
}
.gap-around-2 > * { margin: .25rem; }
.gap-around-4 > * { margin: .5rem; }

Expand All @@ -417,17 +421,19 @@ input.search {
flex-wrap: nowrap;
white-space: nowrap;
width: fit-content;
color: var(--caption-color);
font-size: .75rem;
color: var(--theme-darker-color);
cursor: pointer;

.icon {
margin-right: .25rem;
color: var(--dark-color);
color: var(--theme-content-color);
&.small-size {
width: 1.5rem;
height: 1.5rem;
}
}
&:hover .icon { color: var(--caption-color); }
&:hover .icon { color: var(--theme-caption-color); }
}

/* Margins & Paddings */
Expand Down
7 changes: 7 additions & 0 deletions packages/theme/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -733,3 +733,10 @@
& > * { margin-left: .375rem; }
}
}

/* Kanban - global style */
.kanban-container .card-container .card-labels > * { margin: .25rem .25rem 0 0; }
.kanban-container .card-container .card-labels.labels > *:last-child {
flex-shrink: 0;
margin-right: 0;
}
8 changes: 6 additions & 2 deletions packages/ui/src/components/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,19 @@
&.link-bordered {
padding: 0 0.5rem;
color: var(--theme-content-color);
border-color: var(--theme-divider-color);
background-color: var(--theme-kanban-button-color);
border-color: var(--theme-button-border);
&:hover {
color: var(--theme-caption-color);
background-color: var(--theme-button-hovered);
background-color: var(--theme-kanban-button-hover);
border-color: var(--theme-list-divider-color);
.btn-icon {
color: var(--theme-caption-color);
}
}
&.small {
padding: 0 0.25rem;
}
}
&.list {
padding: 0 0.625em;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/ProgressCircle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
cy={8}
r={7}
class="progress-circle"
style:stroke={'var(--divider-color)'}
style:stroke={'var(--theme-divider-color)'}
style:opacity={'.5'}
style:transform={`rotate(${-78 + ((dashOffset + 1) * 360) / (lenghtC + 1)}deg)`}
style:stroke-dasharray={lenghtC}
Expand Down
5 changes: 4 additions & 1 deletion packages/ui/src/components/calendar/DatePresenter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,13 @@
&.link-bordered {
padding: 0 0.375rem;
color: var(--theme-content-color);
background-color: var(--theme-kanban-button-color);
border-color: var(--theme-button-border);
border-radius: 0.25rem;
&:hover {
color: var(--theme-caption-color);
background-color: var(--theme-button-hovered);
background-color: var(--theme-kanban-button-hover);
border-color: var(--theme-list-divider-color);
.btn-icon {
color: var(--theme-caption-color);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/components/calendar/DueDatePresenter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
import { tooltip } from '../../tooltips'
import DatePresenter from './DatePresenter.svelte'
import { getDaysDifference } from './internal/DateUtils'
import { ButtonKind } from '../../types'
import { ButtonKind, ButtonSize } from '../../types'
export let value: number | null = null
export let shouldRender: boolean = true
export let onChange: (newDate: number | null) => void
export let kind: ButtonKind = 'link'
export let editable: boolean = true
export let shouldIgnoreOverdue: boolean = false
export let size: ButtonSize = 'medium'
const today = new Date(new Date(Date.now()).setHours(0, 0, 0, 0))
$: isOverdue = value !== null && value < today.getTime()
Expand Down Expand Up @@ -90,6 +91,6 @@
}
: undefined}
>
<DatePresenter {value} {editable} icon={iconModifier} {kind} on:change={handleDueDateChanged} />
<DatePresenter {value} {editable} icon={iconModifier} {kind} {size} on:change={handleDueDateChanged} />
</div>
{/if}
17 changes: 16 additions & 1 deletion packages/ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,17 @@ export type TooltipAlignment = 'top' | 'bottom' | 'left' | 'right'
export type VerticalAlignment = 'top' | 'bottom'
export type HorizontalAlignment = 'left' | 'right'

export type IconSize = 'inline' | 'tiny' | 'x-small' | 'smaller' | 'small' | 'medium' | 'large' | 'x-large' | 'full'
export type IconSize =
| 'inline'
| 'tiny'
| 'card'
| 'x-small'
| 'smaller'
| 'small'
| 'medium'
| 'large'
| 'x-large'
| 'full'

export interface DateOrShift {
date?: number
Expand Down Expand Up @@ -311,3 +321,8 @@ export interface DialogStep {
readonly component: AnyComponent | AnySvelteComponent
props?: Record<string, any>
}

export interface AccentColor {
textColor: string
backgroundColor: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
component: AttachmentPopup,
props: { objectId: object._id, attachments: value, object }
}}
class="sm-tool-icon ml-1 mr-1"
class="sm-tool-icon"
>
<span class="icon"><IconAttachment {size} /></span>
{#if showCounter}
&nbsp;{value}
{value}
{/if}
</div>
</DocNavLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
component: CommentPopup,
props: { objectId: object._id, object }
}}
class="sm-tool-icon ml-1 mr-1"
class="sm-tool-icon"
>
<span class="icon"><IconThread {size} /></span>
{#if showCounter}
Expand Down
8 changes: 7 additions & 1 deletion plugins/contact-resources/src/components/Avatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
}}
/>
{:else}
<Icon icon={icon ?? AvatarIcon} {size} />
<Icon icon={icon ?? AvatarIcon} size={size === 'card' ? 'x-small' : size} />
{/if}
</div>

Expand Down Expand Up @@ -160,6 +160,10 @@
height: 1.13rem;
}
.ava-card {
width: 1.25rem; // 20
height: 1.25rem;
}
.ava-x-small {
width: 1.5rem; // 24
height: 1.5rem;
Expand Down Expand Up @@ -197,6 +201,8 @@
.ava-inline .ava-mask,
.ava-inline.no-img,
.ava-card .ava-mask,
.ava-card.no-img,
.ava-x-small .ava-mask,
.ava-x-small.no-img,
.ava-smaller .ava-mask,
Expand Down
6 changes: 3 additions & 3 deletions plugins/tags-resources/src/components/LabelsPresenter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
export let object: WithLookup<Doc>
export let full: boolean
export let ckeckFilled: boolean = false
export let kind: 'short' | 'full' | 'list' = 'short'
export let kind: 'short' | 'full' | 'list' | 'kanban' = 'short'
export let isEditable: boolean = false
export let action: (evt: MouseEvent) => Promise<void> | void = async () => {}
export let compression: boolean = false
Expand Down Expand Up @@ -46,10 +46,10 @@
})
</script>

{#if kind === 'list'}
{#if kind === 'list' || kind === 'kanban'}
{#each items as value}
<div class="label-box no-shrink" title={value.title}>
<TagReferencePresenter attr={undefined} {value} kind={'labels'} />
<TagReferencePresenter attr={undefined} {value} kind={kind === 'kanban' ? 'kanban-labels' : 'labels'} />
</div>
{/each}
{:else}
Expand Down
4 changes: 2 additions & 2 deletions plugins/tags-resources/src/components/TagItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<span
style={`--tag-color:${getPlatformColor(tag?.color ?? element?.color ?? 0)}`}
class="tag-item-inline"
class="tag-item-inline overflow-label max-w-40"
on:click
use:tooltip={{
label: element?.description ? tags.string.TagTooltip : undefined,
Expand All @@ -60,7 +60,7 @@
direction: 'right'
}}
>
{name}
<span class="overflow-label max-w-40">{name}</span>
<span class="ml-1">
{#if tag && tagIcon && schema !== '0'}
<Icon icon={tagIcon} size={'small'} />
Expand Down
Loading

0 comments on commit 439f4bb

Please sign in to comment.