Skip to content

Commit

Permalink
Merge pull request #667 from geonetwork/ME-checkbox-color-overwrite
Browse files Browse the repository at this point in the history
ME: checkbox color options
  • Loading branch information
jahow authored Nov 3, 2023
2 parents 0acb34a + 217b961 commit 3200245
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
24 changes: 24 additions & 0 deletions libs/ui/inputs/src/lib/checkbox/checkbox.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.default {
--gn-ui-checkbox-color: var(--color-main);
}

.secondary {
--gn-ui-checkbox-color: var(--color-secondary);
}

.primary {
--gn-ui-checkbox-color: var(--color-primary);
}

mat-checkbox {
--mdc-checkbox-selected-icon-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-focus-icon-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-hover-icon-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-icon-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-pressed-icon-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-focus-state-layer-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-hover-state-layer-color: var(--gn-ui-checkbox-color);
--mdc-checkbox-selected-pressed-state-layer-color: var(
--gn-ui-checkbox-color
);
}
2 changes: 1 addition & 1 deletion libs/ui/inputs/src/lib/checkbox/checkbox.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<mat-checkbox
class="cursor-pointer"
[class]="classList"
type="checkbox"
[checked]="checked"
[indeterminate]="indeterminate"
(click)="handleClick($event)"
color="primary"
></mat-checkbox>
5 changes: 5 additions & 0 deletions libs/ui/inputs/src/lib/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ import {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CheckboxComponent {
@Input() type: 'primary' | 'secondary' | 'default' = 'default'
@Input() checked = false
@Input() indeterminate? = false
@Output() changed = new EventEmitter<boolean>()

get classList() {
return `${this.type}`
}

handleClick(event: Event) {
event.stopPropagation()
this.checked = !this.checked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
[checked]="isAllSelected()"
[indeterminate]="isSomeSelected()"
(changed)="selectAll()"
type="default"
>
</gn-ui-checkbox>
</div>
Expand Down Expand Up @@ -153,6 +154,7 @@
<gn-ui-checkbox
[checked]="isChecked(record)"
(changed)="handleRecordSelectedChange($event, record)"
type="default"
></gn-ui-checkbox>
</div>
<div
Expand Down

0 comments on commit 3200245

Please sign in to comment.