Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit ff23ade

Browse files
Kern dropdown improvements for disabled buttons
1 parent aaa370d commit ff23ade

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

src/app/base/components/dropdown-iterative/dropdown-iterative.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<div *ngFor="let task of arrayOptions">
3636
<div class="form-control pl-2">
3737
<label
38-
formArrayName="manualLabels"
38+
[formArrayName]="formArrayName"
3939
class="label cursor-pointer"
4040
(click)="performActionOnOption(task,$event)">
4141
<div class="h-4 w-4 border-gray-300 border rounded hover:bg-gray-200"

src/app/base/components/dropdown-iterative/dropdown-iterative.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class DropdownIterativeComponent implements OnInit {
1818
@Input() optionProperty: string;
1919
@Input() disabledCondition: boolean;
2020
@Input() hasCheckboxes: boolean;
21+
@Input() formArrayName: string;
2122

2223
@Output() optionClicked = new EventEmitter<string>();
2324

src/app/data/components/data-browser/data-browser.component.html

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,7 @@
332332
<ng-template
333333
[ngIf]="groupItem.get('manualLabels').controls.length == 0"
334334
[ngIfElse]="dropDownML">
335-
<button disabled
336-
class="flex flex-row flex-nowrap select select-sm select-bordered search_reduced_item_width search_custom_drowdown_disabled ">
337-
<div class="truncate min-w-0 mr-4">
338-
<label class="font-normal">No
339-
Labels
340-
associated with this
341-
task</label>
342-
</div>
343-
</button>
335+
<ng-container [ngTemplateOutlet]="buttonLabelsDisabled"></ng-container>
344336
</ng-template>
345337
<ng-template #dropDownML>
346338
<kern-dropdown-iterative
@@ -357,19 +349,14 @@
357349
<div class="dropdown">
358350
<ng-template
359351
[ngIf]="groupItem.get('weakSupervisionLabels').controls.length == 0"
352+
formArrayName="manualLabels"
360353
[ngIfElse]="dropDownWS">
361-
<button disabled
362-
class="flex flex-row flex-nowrap select select-sm select-bordered search_reduced_item_width search_custom_drowdown_disabled">
363-
<div class="truncate min-w-0 mr-4">
364-
<label class="font-normal">No
365-
Labels associated with this
366-
task</label>
367-
</div>
368-
</button>
354+
<ng-container [ngTemplateOutlet]="buttonLabelsDisabled"></ng-container>
369355
</ng-template>
370356
<ng-template #dropDownWS>
371357
<kern-dropdown-iterative
372358
[arrayOptions]="groupItem.get('weakSupervisionLabels').controls"
359+
formArrayName="manualLabels"
373360
[hasCheckboxes]="true"
374361
(optionClicked)="setActiveNegateGroup($event)"
375362
></kern-dropdown-iterative>
@@ -1150,4 +1137,19 @@ <h1 class="text-lg text-gray-900 mb-2">Info</h1>
11501137
</div>
11511138
</div>
11521139
</div>
1153-
</div>
1140+
</div>
1141+
1142+
<ng-template #buttonLabelsDisabled>
1143+
<button disabled
1144+
class="cursor-not-allowed inline-flex rounded-md border border-gray-300 w-80 shadow-sm px-4 py-1.5 items-center bg-white text-xs font-semibold text-gray-700 cursor-pointer focus:ring-offset-2 focus:ring-offset-gray-400">
1145+
<div class="truncate min-w-0 mr-4">
1146+
No labels associated with this task
1147+
</div>
1148+
<svg class="-mr-1 ml-auto h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
1149+
fill="currentColor" aria-hidden="true">
1150+
<path fill-rule="evenodd"
1151+
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
1152+
clip-rule="evenodd" />
1153+
</svg>
1154+
</button>
1155+
</ng-template>

0 commit comments

Comments
 (0)