Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Correct some colours and spacings & do some linting

Henriette Darge78ba300f44b9
diff --git a/frontend/src/app/spot/components/checkbox/checkbox.component.ts b/frontend/src/app/spot/components/checkbox/checkbox.component.ts
index f9a06c00cfe..d641a35aa9f 100644
--- a/frontend/src/app/spot/components/checkbox/checkbox.component.ts
+++ b/frontend/src/app/spot/components/checkbox/checkbox.component.ts
@@ -2,13 +2,16 @@ import {
Component,
ElementRef,
EventEmitter,
- ViewChild,
forwardRef,
HostBinding,
Input,
Output,
+ ViewChild,
} from '@angular/core';
-import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
+import {
+ ControlValueAccessor,
+ NG_VALUE_ACCESSOR,
+} from '@angular/forms';
export type SpotCheckboxState = true|false|null;
@@ -34,36 +37,37 @@ export class SpotCheckboxComponent implements ControlValueAccessor {
@Input() public checked = false;
- onStateChange() {
- const value = this.input.nativeElement.checked;
+ onStateChange():void {
+ const value = (this.input.nativeElement as HTMLInputElement).checked;
this.checkedChange.emit(value);
this.onChange(value);
this.onTouched(value);
}
- writeValue(value:SpotCheckboxState) {
+ writeValue(value:SpotCheckboxState):void {
// This is set in a timeout because the initial value is set before the template is ready,
// which causes the input nativeElement to not be available yet.
setTimeout(() => {
- const input = this.input.nativeElement;
+ const input = this.input.nativeElement as HTMLInputElement;
if (value === null) {
input.indeterminate = true;
} else {
input.indeterminate = false;
}
-
+
this.checked = !!value;
});
}
- onChange = (_:SpotCheckboxState) => {};
- onTouched = (_:SpotCheckboxState) => {};
+ onChange = (_:SpotCheckboxState):void => {};
+
+ onTouched = (_:SpotCheckboxState):void => {};
- registerOnChange(fn:any) {
+ registerOnChange(fn:any):void {
this.onChange = fn;
}
- registerOnTouched(fn:any) {
+ registerOnTouched(fn:any):void {
this.onTouched = fn;
}
}
diff --git a/frontend/src/app/spot/components/chip-field/chip-field.component.ts b/frontend/src/app/spot/components/chip-field/chip-field.component.ts
index d3b5fb56390..0c72a467bb5 100644
--- a/frontend/src/app/spot/components/chip-field/chip-field.component.ts
+++ b/frontend/src/app/spot/components/chip-field/chip-field.component.ts
@@ -20,6 +20,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
})
export class SpotChipFieldComponent implements ControlValueAccessor {
@HostBinding('class.spot-chip-field') public classNameChipField = true;
+
@HostBinding('class.spot-text-field') public classNameTextField = true;
@HostListener('click') public onParentClick() {
@@ -29,27 +30,30 @@ export class SpotChipFieldComponent implements ControlValueAccessor {
@ViewChild('input') public input:ElementRef;
@Input() name = `spot-chip-field-${+(new Date())}`;
+
@Input() disabled = false;
+
@Input() public placeholder = '';
+
@Input('value') public _value:string[] = [];
- public textValue = '';
+ textValue = '';
- public get value():string[] {
+ get value():string[] {
return this._value;
}
- public set value(value:string[]) {
+ set value(value:string[]) {
this._value = value;
this.onChange(value);
this.onTouched(value);
}
- public remove(i:number) {
+ remove(i:number):void {
this.value = this.value.slice(0, i).concat(this.value.slice(i + 1));
}
- public onBackspace(e:KeyboardEvent) {
+ onBackspace(e:KeyboardEvent):void {
if (this.textValue !== '') {
return;
}
@@ -59,7 +63,7 @@ export class SpotChipFieldComponent implements ControlValueAccessor {
this.value = this.value.slice(0, this.value.length - 1);
}
- public onEnter(e:KeyboardEvent) {
+ onEnter(e:KeyboardEvent):void {
e.stopPropagation();
if (this.textValue === '') {
@@ -76,19 +80,19 @@ export class SpotChipFieldComponent implements ControlValueAccessor {
this.textValue = '';
}
- writeValue(value:string[]) {
+ writeValue(value:string[]):void {
this.value = value;
}
- onChange = (_:string[]) => {};
- onTouched = (_:string[]) => {};
+ onChange = (_:string[]):void => {};
+
+ onTouched = (_:string[]):void => {};
- registerOnChange(fn:any) {
+ registerOnChange(fn:any):void {
this.onChange = fn;
}
- registerOnTouched(fn:any) {
+ registerOnTouched(fn:any):void {
this.onTouched = fn;
}
}
-
diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
index de075db1e74..50d18e52065 100644
--- a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
+++ b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
@@ -25,8 +25,12 @@ export class SpotDropModalComponent implements OnDestroy {
@HostBinding('class.spot-drop-modal_opened') public _open = false;
+ @Output() closed = new EventEmitter<void>();
+
+ @Input('alignment') public alignment:SpotDropModalAlignmentOption = SpotDropModalAlignmentOption.BottomLeft;
+
@Input('open')
- public set open(value:boolean) {
+ set open(value:boolean) {
this._open = value;
if (this._open) {
@@ -43,32 +47,27 @@ export class SpotDropModalComponent implements OnDestroy {
}
}
- public get open():boolean {
+ get open():boolean {
return this._open;
}
- @Input('alignment') public alignment:SpotDropModalAlignmentOption = SpotDropModalAlignmentOption.BottomCenter;
-
- get alignmentClass() {
+ get alignmentClass():string {
return `spot-drop-modal--body_${this.alignment}`;
}
- @Output() closed = new EventEmitter<void>();
-
- private closeEventListener = this.close.bind(this);
-
- public close():void {
+ close():void {
this.open = false;
}
- public onBodyClick(e:MouseEvent) {
+ onBodyClick(e:MouseEvent):void {
// We stop propagation here so that clicks inside the body do not
// close the modal when the event reaches the document body
e.stopPropagation();
}
- public ngOnDestroy():void {
+ ngOnDestroy():void {
document.body.removeEventListener('click', this.closeEventListener);
}
-}
+ private closeEventListener = this.close.bind(this);
+}
diff --git a/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts b/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
index 87d0d804f0d..4ab898ae898 100644
--- a/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
+++ b/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
@@ -14,6 +14,7 @@ export class SpotFilterChipComponent {
@HostBinding('class.spot-filter-chip') public className = true;
@Input() removable = true;
+
@Input() title = '';
@Output() remove = new EventEmitter<void>();
diff --git a/frontend/src/app/spot/components/text-field/text-field.component.ts b/frontend/src/app/spot/components/text-field/text-field.component.ts
index 8b56078abe7..9ffecb5abb4 100644
--- a/frontend/src/app/spot/components/text-field/text-field.component.ts
+++ b/frontend/src/app/spot/components/text-field/text-field.component.ts
@@ -28,15 +28,18 @@ export class SpotTextFieldComponent implements ControlValueAccessor {
@ViewChild('input') public input:ElementRef;
@Input() name = `spot-text-field-${+(new Date())}`;
+
@Input() disabled = false;
+
@Input() public placeholder = '';
+
@Input('value') public _value = '';
- public get value():string {
+ get value():string {
return this._value;
}
- public set value(value:string) {
+ set value(value:string) {
this._value = value;
this.onChange(value);
this.onTouched(value);
@@ -46,15 +49,15 @@ export class SpotTextFieldComponent implements ControlValueAccessor {
this.value = value;
}
- onChange = (_:string) => {};
- onTouched = (_:string) => {};
+ onChange = (_:string):void => {};
- registerOnChange(fn:any) {
+ onTouched = (_:string):void => {};
+
+ registerOnChange(fn:any):void {
this.onChange = fn;
}
- registerOnTouched(fn:any) {
+ registerOnTouched(fn:any):void {
this.onTouched = fn;
}
}
-
diff --git a/frontend/src/app/spot/components/toggle/toggle.component.ts b/frontend/src/app/spot/components/toggle/toggle.component.ts
index 3c8eeacd145..907b41993f7 100644
--- a/frontend/src/app/spot/components/toggle/toggle.component.ts
+++ b/frontend/src/app/spot/components/toggle/toggle.component.ts
@@ -28,7 +28,9 @@ export class SpotToggleComponent<T> implements ControlValueAccessor {
@Output() checkedChange = new EventEmitter<boolean>();
@Input() options:SpotToggleOption<T>[] = [];
+
@Input() name = `spot-toggle-${+(new Date())}`;
+
@Input('value') public _value:T;
public get value():T {
@@ -41,19 +43,19 @@ export class SpotToggleComponent<T> implements ControlValueAccessor {
this.onTouched(value);
}
- writeValue(value:T) {
+ writeValue(value:T):void {
this.value = value;
}
- onChange = (_:T) => {};
- onTouched = (_:T) => {};
+ onChange = (_:T):void => {};
- registerOnChange(fn:any) {
+ onTouched = (_:T):void => {};
+
+ registerOnChange(fn:any):void {
this.onChange = fn;
}
- registerOnTouched(fn:any) {
+ registerOnTouched(fn:any):void {
this.onTouched = fn;
}
}
-
diff --git a/frontend/src/app/spot/spot-docs.component.html b/frontend/src/app/spot/spot-docs.component.html
index 5c19b734d4a..61b4faec09d 100644
--- a/frontend/src/app/spot/spot-docs.component.html
+++ b/frontend/src/app/spot/spot-docs.component.html
@@ -69,25 +69,25 @@ Currently selected value is {{ toggleValue }}
<ul class="spot-list">
<li class="spot-list--item">
<label class="spot-list--item-action">
- <spot-checkbox [(ngModel)]="checkboxValue"></spot-checkbox>
+ <spot-checkbox [(ngModel)]="listCheckboxValue"></spot-checkbox>
<div class="spot-list--item-title">Checkbox item</div>
</label>
</li>
<li class="spot-list--item">
<label class="spot-list--item-action">
- <spot-checkbox [(ngModel)]="checkboxValue"></spot-checkbox>
+ <spot-checkbox [(ngModel)]="listCheckboxValue"></spot-checkbox>
<div class="spot-list--item-title">Checkbox item with children</div>
</label>
<ul class="spot-list">
<li class="spot-list--item">
<label class="spot-list--item-action">
- <spot-checkbox [(ngModel)]="checkboxValue"></spot-checkbox>
+ <spot-checkbox [(ngModel)]="listCheckboxValue"></spot-checkbox>
<div class="spot-list--item-title">Child checkbox item</div>
</label>
</li>
<li class="spot-list--item">
<label class="spot-list--item-action">
- <spot-checkbox [(ngModel)]="checkboxValue"></spot-checkbox>
+ <spot-checkbox [(ngModel)]="listCheckboxValue"></spot-checkbox>
<div class="spot-list--item-title">Second child checkbox item</div>
</label>
</li>
diff --git a/frontend/src/app/spot/spot-docs.component.ts b/frontend/src/app/spot/spot-docs.component.ts
index 778ff09cc1f..be1a9f76d62 100644
--- a/frontend/src/app/spot/spot-docs.component.ts
+++ b/frontend/src/app/spot/spot-docs.component.ts
@@ -7,6 +7,7 @@ import { Component } from '@angular/core';
export class SpotDocsComponent {
indeterminateState = null;
checkboxValue = null;
+ listCheckboxValue = null;
textFieldValue = 'ngModel value';
dropModalOpen = false;
alignment = 'bottom-center';
diff --git a/frontend/src/app/spot/styles/sass/components/button.sass b/frontend/src/app/spot/styles/sass/components/button.sass
index 93285a91b7c..97143097904 100644
--- a/frontend/src/app/spot/styles/sass/components/button.sass
+++ b/frontend/src/app/spot/styles/sass/components/button.sass
@@ -5,7 +5,7 @@
flex-direction: row
flex-wrap: nowrap
margin: 0
- padding: $spot-spacing-0_5
+ padding: $spot-spacing-0_5 $spot-spacing-0_75
border-width: 1px
border-style: solid
border-radius: $spot-spacing-1
@@ -21,7 +21,7 @@
background-color: $spot-color-basic-gray-6
border-color: $spot-color-basic-gray-6
color: $spot-color-main-dark
-
+
&:active
background-color: $spot-color-basic-gray-6
border-color: $spot-color-basic-gray-6
@@ -91,7 +91,7 @@
background-color: $spot-color-basic-gray-6
border-color: $spot-color-main
color: $spot-color-main
-
+
&:active
background-color: $spot-color-basic-white
border-color: $spot-color-basic-white
@@ -106,7 +106,7 @@
background-color: $spot-color-main-light
border-color: $spot-color-main
color: $spot-color-main
-
+
&:active
background-color: $spot-color-main
border-color: $spot-color-basic-white
@@ -121,7 +121,7 @@
background-color: $spot-color-accent-light
border-color: $spot-color-accent
color: $spot-color-accent
-
+
&:active
background-color: $spot-color-accent
border-color: $spot-color-basic-white
@@ -136,7 +136,7 @@
background-color: $spot-color-danger-light
border-color: $spot-color-danger
color: $spot-color-danger
-
+
&:active
background-color: $spot-color-danger
border-color: $spot-color-basic-white
@@ -158,7 +158,7 @@
&:hover
color: $spot-color-main-dark
-
+
&:active
color: $spot-color-main
@@ -167,7 +167,7 @@
&:hover
color: $spot-color-accent-dark
-
+
&:active
color: $spot-color-accent
@@ -176,7 +176,6 @@
&:hover
color: $spot-color-danger-dark
-
+
&:active
color: $spot-color-danger
-
diff --git a/frontend/src/app/spot/styles/sass/components/checkbox.sass b/frontend/src/app/spot/styles/sass/components/checkbox.sass
index 9e22d0781f8..f3f6cec9322 100644
--- a/frontend/src/app/spot/styles/sass/components/checkbox.sass
+++ b/frontend/src/app/spot/styles/sass/components/checkbox.sass
@@ -36,6 +36,9 @@
height: 2px
background-color: $spot-color-main
+ &--input:checked + &--fake
+ background-color: $spot-color-main-light
+
&--input:checked + &--fake::before,
&--input:checked + &--fake::after
border-radius: 1px
@@ -57,6 +60,9 @@
border-color: $spot-color-basic-gray-3
cursor: default
+ &--input:disabled:checked + &--fake
+ background-color: $spot-color-basic-gray-5
+
&--input:disabled + &--fake::before,
&--input:disabled + &--fake::after
background-color: $spot-color-basic-gray-3
diff --git a/frontend/src/app/spot/styles/sass/components/drop-modal.sass b/frontend/src/app/spot/styles/sass/components/drop-modal.sass
index 165dedc1599..cf806731574 100644
--- a/frontend/src/app/spot/styles/sass/components/drop-modal.sass
+++ b/frontend/src/app/spot/styles/sass/components/drop-modal.sass
@@ -13,29 +13,29 @@
opacity: 0
&_bottom-center
- top: 100%
+ top: calc(100% + #{$spot-spacing-0_25})
left: 50%
transform: translateX(-50%)
&_bottom-left
- top: 100%
+ top: calc(100% + #{$spot-spacing-0_25})
left: 0%
&_bottom-right
- top: 100%
+ top: calc(100% + #{$spot-spacing-0_25})
right: 0%
&_top-center
- bottom: 100%
+ bottom: calc(100% + #{$spot-spacing-0_25})
left: 50%
transform: translateX(-50%)
&_top-left
- bottom: 100%
+ bottom: calc(100% + #{$spot-spacing-0_25})
left: 0%
&_top-right
- bottom: 100%
+ bottom: calc(100% + #{$spot-spacing-0_25})
right: 0%
&_opened &--body
diff --git a/frontend/src/app/spot/styles/sass/components/text-field.sass b/frontend/src/app/spot/styles/sass/components/text-field.sass
index 7897fa1096f..b52a5a5a3d4 100644
--- a/frontend/src/app/spot/styles/sass/components/text-field.sass
+++ b/frontend/src/app/spot/styles/sass/components/text-field.sass
@@ -15,8 +15,9 @@
&:focus,
&:focus-within
- border-color: $spot-color-main-dark
- color: $spot-color-main-dark
+ border-color: $spot-color-indication-attention
+ color: $spot-color-basic-black
+ outline: none
&--input
background: transparent
diff --git a/frontend/src/app/spot/styles/sass/components/toggle.sass b/frontend/src/app/spot/styles/sass/components/toggle.sass
index edffbbadf86..4d8cea30548 100644
--- a/frontend/src/app/spot/styles/sass/components/toggle.sass
+++ b/frontend/src/app/spot/styles/sass/components/toggle.sass
@@ -14,9 +14,9 @@
padding: $spot-spacing-0_5
border-width: 1px
border-style: solid
- border-color: $spot-color-main
+ border-color: $spot-color-main-dark
background-color: transparent
- color: $spot-color-main
+ color: $spot-color-main-dark
cursor: pointer
&:not(:last-child)
@@ -34,7 +34,6 @@
&_selected
background-color: $spot-color-main-light
-
&--option-input
position: absolute