Skip to content

Commit

Permalink
chore: fix checkbox styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
RberendsDITP committed Dec 12, 2024
1 parent c039751 commit 6798ed9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/component-library-angular/src/checkbox/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ export class TilburgCheckbox {
onCheckChange(event: Event) {
this.checkChanged.emit(event);
}

mouseUp(event: MouseEvent) {
(event.target as HTMLInputElement).classList.remove('tilburg-checkbox-pressed');
}
mouseDown(event: MouseEvent) {
(event.target as HTMLInputElement).classList.add('tilburg-checkbox-pressed');
}
}
4 changes: 3 additions & 1 deletion packages/component-library-angular/src/checkbox/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<input
type="checkbox"
[id]="id"
[attr.aria-label]="ariaLabel"
[disabled]="disabled"
[checked]="checked"
(change)="onCheckChange($event)"
(mouseup)="mouseUp($event)"
(mousedown)="mouseDown($event)"
utrecht-checkbox
/>
6 changes: 3 additions & 3 deletions packages/component-library-angular/src/checkbox/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
border-color: var(--utrecht-checkbox-disabled-border-color, var(--utrecht-checkbox-border-color));
}

&:focus-visible:not(:disabled) {
&:focus-visible:not(:disabled, [aria-disabled="true"]) {
background-color: var(--utrecht-checkbox-focus-background-color, var(--utrecht-checkbox-background-color));
border-color: var(--utrecht-checkbox-focus-border-color, var(--utrecht-checkbox-border-color));
border-width: var(--utrecht-checkbox-focus-border-width, var(--utrecht-checkbox-border-width));
Expand Down Expand Up @@ -46,8 +46,8 @@
border-color: var(--utrecht-checkbox-disabled-border-color, var(--utrecht-checkbox-border-color));
}

&:focus,
&:focus-visible:not(:active) {
&:focus.tilburg-checkbox-pressed:active:not([aria-disabled="true"]),
&:focus-visible:not(:active, .tilburg-checkbox-pressed, [aria-disabled="true"]) {
background-color: #e6f6ff;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
border-color: var(--utrecht-form-control-focus-border-color, var(--utrecht-form-control-focus-border-color));
Expand Down

0 comments on commit 6798ed9

Please sign in to comment.