Replaces the question-marks in config with hints

This commit is contained in:
GabrielMeyer 2019-10-21 16:32:10 +02:00
parent 62e5774c8d
commit 19347f89d0
5 changed files with 94 additions and 54 deletions

View File

@ -38,11 +38,14 @@
[type]="formType(configItem.inputType)" [type]="formType(configItem.inputType)"
/> />
</ng-template> </ng-template>
<mat-hint *ngIf="configItem.helpText">{{ configItem.helpText | translate }}</mat-hint>
</mat-form-field> </mat-form-field>
<div class="config-form-group" *ngIf="isExcludedType(configItem.inputType)"> <div class="config-form-group" *ngIf="isExcludedType(configItem.inputType)">
<div *ngIf="configItem.inputType === 'boolean'"> <div *ngIf="configItem.inputType === 'boolean'">
<mat-checkbox formControlName="value">{{ configItem.label | translate }}</mat-checkbox> <mat-checkbox formControlName="value">{{ configItem.label | translate }}</mat-checkbox>
<div class="hint" *ngIf="configItem.helpText">{{ configItem.helpText | translate }}</div>
<div class="error" *ngIf="error">{{ error }}</div> <div class="error" *ngIf="error">{{ error }}</div>
</div> </div>
@ -90,7 +93,9 @@
<input matInput [format]="24" formControlName="time" [ngxTimepicker]="timepicker" /> <input matInput [format]="24" formControlName="time" [ngxTimepicker]="timepicker" />
<div class="suffix-wrapper" matSuffix> <div class="suffix-wrapper" matSuffix>
<mat-icon class="red-warning-text" *ngIf="updateSuccessIcon">error</mat-icon> <mat-icon class="red-warning-text" *ngIf="updateSuccessIcon">error</mat-icon>
<ngx-material-timepicker-toggle [for]="timepicker"></ngx-material-timepicker-toggle> <ngx-material-timepicker-toggle [for]="timepicker">
<mat-icon ngxMaterialTimepickerToggleIcon>access_time</mat-icon>
</ngx-material-timepicker-toggle>
</div> </div>
<mat-error *ngIf="error"> {{ error }} </mat-error> <mat-error *ngIf="error"> {{ error }} </mat-error>
<ngx-material-timepicker #timepicker></ngx-material-timepicker> <ngx-material-timepicker #timepicker></ngx-material-timepicker>
@ -114,9 +119,4 @@
</div> </div>
</form> </form>
</div> </div>
<div class="reset-button">
<button mat-icon-button *ngIf="configItem.helpText" matTooltip="{{ configItem.helpText | translate }}">
<mat-icon>help_outline</mat-icon>
</button>
</div>
</div> </div>

View File

@ -1,13 +1,31 @@
/* Full width form fields */ .config-field-wrapper {
.mat-form-field {
width: 100%; width: 100%;
} display: flex;
.datetimepicker-container { .form-item {
margin-left: -20px; flex: 2;
}
.mat-form-field { .mat-form-field {
width: 50%; .mat-form-field-subscript-wrapper {
position: static;
}
.mat-form-field-underline {
display: none;
}
}
/* Full width form fields */
.mat-form-field {
width: 100%;
}
.datetimepicker-container {
margin-left: -20px;
display: flex;
.mat-form-field {
flex: 1;
box-sizing: border-box; box-sizing: border-box;
padding-left: 20px; padding-left: 20px;
@ -30,28 +48,15 @@
} }
} }
} }
} }
/* limit the color bar of color inputs */ /* limit the color bar of color inputs */
input[type='color'] { input[type='color'] {
max-width: 100px; max-width: 100px;
} }
/* Spacing between config entries */ /* Spacing between config entries */
.config-form-group { .config-form-group {
margin-bottom: 15px; margin-bottom: 15px;
}
.config-field-wrapper {
width: 100%;
display: flex;
.form-item {
flex: 2;
}
.reset-button {
max-width: 30px;
width: 30px;
flex: 1;
} }
} }

View File

@ -0,0 +1,23 @@
@import '~@angular/material/theming';
@mixin os-config-field-style($theme) {
$foreground: map-get($theme, foreground);
$is-dark-theme: map-get($theme, is-dark);
.config-field-wrapper {
.mat-form-field {
.mat-form-field-flex {
border-bottom: 1px solid mat-color($foreground, divider, if($is-dark-theme, 0.7, 0.42));
}
}
.datetimepicker-container {
.ngx-material-timepicker-toggle {
mat-icon {
color: mat-color($foreground, icon);
}
}
}
}
}

View File

@ -11,6 +11,8 @@
$foreground: map-get($theme, foreground); $foreground: map-get($theme, foreground);
$background: map-get($theme, background); $background: map-get($theme, background);
$is-dark-theme: map-get($theme, is-dark);
h1, h1,
h3.accent { h3.accent {
color: mat-color($primary); color: mat-color($primary);
@ -39,6 +41,14 @@
background: mat-color($background, background); background: mat-color($background, background);
} }
.underline {
border-bottom: 1px solid mat-color($foreground, divider, if($is-dark-theme, 0.7, 0.42));
}
.hint {
color: mat-color($foreground, secondary-text);
}
/* Custom hint and error classes. Same values as .mat-hint and -mat-error */ /* Custom hint and error classes. Same values as .mat-hint and -mat-error */
.hint, .hint,
.error { .error {

View File

@ -24,6 +24,7 @@
@import './app/site/common/components/super-search/super-search.component.scss'; @import './app/site/common/components/super-search/super-search.component.scss';
@import './app/shared/components/rounded-input/rounded-input.component.scss'; @import './app/shared/components/rounded-input/rounded-input.component.scss';
@import './app/shared/components/meta-text-block/meta-text-block.component.scss'; @import './app/shared/components/meta-text-block/meta-text-block.component.scss';
@import './app/site/config/components/config-field/config-field.component.scss-theme.scss';
/** fonts */ /** fonts */
@import './assets/styles/fonts.scss'; @import './assets/styles/fonts.scss';
@ -48,6 +49,7 @@ $narrow-spacing: (
@include os-super-search-style($theme); @include os-super-search-style($theme);
@include os-rounded-input-style($theme); @include os-rounded-input-style($theme);
@include os-meta-text-block-style($theme); @include os-meta-text-block-style($theme);
@include os-config-field-style($theme);
} }
/** Load projector specific SCSS values */ /** Load projector specific SCSS values */