Skip to content

Commit

Permalink
feat(workflows): ui review III
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaviju committed Oct 2, 2023
1 parent 6229df9 commit ffde190
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,11 @@
<ng-container *ngIf="vm.project.workflows.length > 1">
<tg-ui-breadcrumb
class="story-breadcrumb story-breadcrumb-modal"
[collapsable]="true"
[crumbs]="[
t('kanban.workflows'),
vm.story.workflow.name
]"
[type]="
vm.selectedStoryView === 'side-view'
? 'collapsed'
: 'expanded'
">
]">
</tg-ui-breadcrumb>
</ng-container>
<tg-story-detail-status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Copyright (c) 2023-present Kaleidos INC
@import url("tools/typography.css");
@import url("../../styles/delete-comment-confirm.css");

:host() {
:host {
container-type: inline-size;
display: block;
}
Expand Down
26 changes: 25 additions & 1 deletion javascript/libs/ui/src/lib/breadcrumb/breadcrumb.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ Copyright (c) 2023-present Kaleidos INC
display: block;
}

:host(.collapsable) {
container-type: inline-size;
}

.breadcrumb-wrapper {
align-items: center;
display: flex;
}

.crumb {
padding: var(--spacing-4);
white-space: nowrap;
}

.crumb-divider {
Expand All @@ -29,8 +39,22 @@ Copyright (c) 2023-present Kaleidos INC
font-weight: 500;
}

.collapsed-crumb-icon {
.crumb-icon {
block-size: var(--spacing-16);
color: var(--color-gray40);
inline-size: var(--spacing-16);
}

.collapsed {
display: none;
}

@container (inline-size < 200px) {
.expanded {
display: none;
}

.collapsed {
display: block;
}
}
38 changes: 19 additions & 19 deletions javascript/libs/ui/src/lib/breadcrumb/breadcrumb.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@
-->

<ng-container *transloco="let t">
<ng-container *ngIf="type === 'expanded'">
<div class="breadcrumb-wrapper">
<tui-svg
[tgUiTooltip]="
t('kanban.workflow').charAt(0).toUpperCase() +
t('kanban.workflow').slice(1)
"
tgUiTooltipPosition="bottom"
class="crumb-icon collapsed"
role="image"
[attr.aria-label]="t('kanban.workflow')"
[src]="icon"></tui-svg>
<ng-container
*ngFor="
let crumb of crumbs;
trackBy: trackByIndex;
last as isLast;
index as i
">
<span
<div
*ngIf="hideLastCrumb && !isLast"
class="crumb"
[class.accent]="isLast && accent">
class="crumb">
{{ crumb }}
</span>
<span
</div>
<div
*ngIf="!hideLastCrumb"
class="crumb"
[class.expanded]="!isLast"
[class.accent]="isLast && accent">
{{ crumb }}
</span>
</div>
<tui-svg
class="crumb-divider"
class="crumb-divider expanded"
*ngIf="!(hideLastCrumb && i === crumbs.length - 2) && !isLast"
src="chevron-right"></tui-svg>
</ng-container>
</ng-container>
<ng-container *ngIf="type === 'collapsed'">
<tui-svg
class="collapsed-crumb-icon"
role="image"
[attr.aria-label]="t('kanban.workflow')"
[src]="icon"></tui-svg>
<span class="crumb">
{{ crumbs.at(-1) }}
</span>
</ng-container>
</div>
</ng-container>
17 changes: 12 additions & 5 deletions javascript/libs/ui/src/lib/breadcrumb/breadcrumb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,34 @@
*/

import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
HostBinding,
Input,
} from '@angular/core';
import { TranslocoDirective } from '@ngneat/transloco';
import { TuiSvgModule } from '@taiga-ui/core';

type BreadCrumbType = 'expanded' | 'collapsed';
import { TooltipDirective } from '../tooltip';

@Component({
selector: 'tg-ui-breadcrumb',
templateUrl: './breadcrumb.component.html',
styleUrls: ['./breadcrumb.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [CommonModule, TranslocoDirective, TuiSvgModule],
imports: [CommonModule, TranslocoDirective, TuiSvgModule, TooltipDirective],
})
export class BreadcrumbComponent {
@Input({ required: true }) public crumbs: string[] = [];
@Input() public icon = 'kanban';
@Input() public accent = false;
@Input() public type: BreadCrumbType = 'expanded';
@Input() public hideLastCrumb = false;

@Input()
@HostBinding('class.collapsable')
public collapsable = false;

public trackByIndex(index: number) {
return index;
}
Expand Down

0 comments on commit ffde190

Please sign in to comment.