Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
[ui] vertical align the buttons inside button group
Browse files Browse the repository at this point in the history
Signed-off-by: Jeeyun Lim <[email protected]>
  • Loading branch information
jeeyun committed Aug 13, 2018
1 parent 46d5ee1 commit d8bdb2b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

.btn {
margin: 0;
vertical-align: top;

&:not(:first-child) {
border-top-left-radius: 0;
Expand Down
29 changes: 24 additions & 5 deletions src/dev/src/app/datagrid/kitchen-sink/kitchen-sink.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,35 @@ <h3>Multi selection</h3>
<em *ngIf="!toEdit">No user selected.</em>
<span class="username" *ngIf="toEdit">{{toEdit.name}}</span>
</p>

<p class="card-text username-list">
Users to be exported:
<em *ngIf="toExport.length == 0">No user selected.</em>
<span class="username" *ngFor="let user of toExport">{{user.name}}</span>
</p>
</div>

<clr-datagrid [(clrDgSelected)]="selected">
<clr-dg-action-bar>
<div class="btn-group" role="group" aria-label="Available Actions" *ngIf="selected.length > 0">
<button type="button" class="btn btn-sm btn-secondary" (click)="onAdd()"><clr-icon shape="plus"></clr-icon> Add
to
group</button>
<button type="button" class="btn btn-sm btn-secondary" (click)="onDelete()" ><clr-icon shape="close"></clr-icon> Delete</button>
<button type="button" class="btn btn-sm btn-secondary" (click)="onEdit()" *ngIf="selected.length == 1"><clr-icon shape="pencil"></clr-icon> Edit</button>
<button type="button" class="btn btn-sm btn-secondary" (click)="onAdd()">
Add to group
</button>
<button type="button" class="btn btn-sm btn-secondary" (click)="onDelete()">Delete</button>
<button type="button" class="btn btn-sm btn-secondary" (click)="onEdit()" *ngIf="selected.length == 1">Edit</button>
</div>

<div class="btn-group">
<clr-dropdown>
<button type="button" class="btn btn-sm btn-secondary" clrDropdownTrigger>
Export
<clr-icon shape="caret down"></clr-icon>
</button>
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
<button type="button" (click)="onExportAll()" clrDropdownItem>Export All</button>
<button type="button" (click)="onExportSelected()" [disabled]="selected.length === 0" clrDropdownItem>Export Selected Items</button>
</clr-dropdown-menu>
</clr-dropdown>
</div>
</clr-dg-action-bar>

Expand Down
12 changes: 12 additions & 0 deletions src/dev/src/app/datagrid/kitchen-sink/kitchen-sink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class DatagridKitchenSinkDemo {
toAdd: User[] = [];
toDelete: User[] = [];
toEdit: User;
toExport: User[] = [];
detail = 'default';
replace = false;
fixedHeight = false;
Expand Down Expand Up @@ -77,6 +78,7 @@ export class DatagridKitchenSinkDemo {
this.toAdd = [];
this.toDelete = [];
this.toEdit = null;
this.toExport = [];
}

onDelete(user: User) {
Expand All @@ -102,6 +104,16 @@ export class DatagridKitchenSinkDemo {
this.toAdd = this.selected.slice();
}

onExportAll() {
this.cleanUp();
this.toExport = this.users.slice();
}

onExportSelected() {
this.cleanUp();
this.toExport = this.selected.slice();
}

toggleId() {
this.showId = !this.showId;
}
Expand Down

0 comments on commit d8bdb2b

Please sign in to comment.