Skip to content

Commit fed6e87

Browse files
committed
error borders fix & description label
1 parent d5f0083 commit fed6e87

4 files changed

Lines changed: 23 additions & 18 deletions

File tree

src/app/resources/resources-add.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
<input matInput formControlName="year">
2323
</mat-form-field>
2424
<div class="full-width markdown-field">
25-
<label class="header-label markdown-label" i18n>Description</label>
26-
<planet-markdown-textbox class="full-width" required="true" [formControl]="resourceForm.controls.description"></planet-markdown-textbox>
25+
<label for="resource-description" class="header-label markdown-label" i18n>Description</label>
26+
<planet-markdown-textbox id="resource-description" class="full-width" required="true" [formControl]="resourceForm.controls.description"></planet-markdown-textbox>
2727
<p class="mat-caption warn-text-color markdown-error" *ngIf="resourceForm.controls.description.touched && resourceForm.controls.description.invalid">
2828
<planet-form-error-messages [control]="resourceForm.controls.description"></planet-form-error-messages>
2929
</p>

src/app/resources/resources-add.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.view-container {
55
display: grid;
66
grid-template-rows: auto 42px;
7-
> * {
7+
> :first-child {
88
overflow-y: auto;
99
}
1010
}

src/app/shared/forms/planet-markdown-textbox.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export class PlanetMarkdownTextboxComponent implements ControlValueAccessor, DoC
2929

3030
@HostBinding() id = `planet-markdown-textbox-${PlanetMarkdownTextboxComponent.nextId++}`;
3131
@HostBinding('attr.aria-describedby') describedBy = '';
32+
@HostBinding('class.is-invalid') get isInvalid() {
33+
return this.errorState;
34+
}
35+
@HostBinding('class.is-focused') get isFocused() {
36+
return this.focused;
37+
}
3238
@ViewChild('editor') editor;
3339
@Input() _value: ValueWithImages | string;
3440
get value(): ValueWithImages | string {

src/app/shared/forms/planet-markdown-textbox.scss

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
@use '../../variables' as v;
22

3-
@mixin editor-border-color($color) {
4-
border-top-color: $color;
5-
border-left-color: $color;
6-
border-right-color: $color;
7-
border-bottom-color: $color;
3+
@mixin editor-border($color) {
4+
.EasyMDEContainer .editor-toolbar {
5+
border-color: $color;
6+
border-bottom: 1px solid $color;
7+
}
8+
.EasyMDEContainer .CodeMirror {
9+
border-color: $color;
10+
}
811
}
912

10-
.mat-form-field-invalid planet-markdown-textbox {
11-
.editor-toolbar, .CodeMirror {
12-
@include editor-border-color(v.$warn);
13-
}
13+
planet-markdown-textbox.is-invalid {
14+
@include editor-border(v.$warn);
1415
}
1516

16-
.mat-focused.ng-valid planet-markdown-textbox, .mat-focused.ng-untouched planet-markdown-textbox {
17-
.editor-toolbar, .CodeMirror {
18-
@include editor-border-color(v.$primary);
19-
}
17+
planet-markdown-textbox.is-focused:not(.is-invalid) {
18+
@include editor-border(v.$primary);
2019
}
2120

2221
planet-markdown-textbox {
2322
.CodeMirror, .CodeMirror-scroll {
2423
height: inherit;
25-
min-height: 15vh !important;
24+
min-height: 15vh;
2625
max-height: 15vh;
27-
padding-bottom: 30px !important;
26+
padding-bottom: 30px;
2827
}
2928

3029
.CodeMirror.CodeMirror-fullscreen {

0 commit comments

Comments
 (0)