Skip to content

Commit 203e316

Browse files
Merge pull request #224 from porscheinformatik/bugfix/isakovic/fix-stepper-styling
fix: stepper error state color, css, add mat-error to stepper demo
2 parents 9ca7c9c + 16e18e6 commit 203e316

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/material-addons/src/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {
1010
OnInit,
1111
Output,
1212
SimpleChanges,
13-
ViewChild
14-
} from "@angular/core";
15-
import { ControlContainer, FormGroupDirective } from "@angular/forms";
16-
import { ReadOnlyFormFieldComponent } from "../readonly-form-field/readonly-form-field.component";
17-
import { NgIf } from "@angular/common";
18-
import { ObserversModule } from "@angular/cdk/observers";
13+
ViewChild,
14+
} from '@angular/core';
15+
import { ControlContainer, FormGroupDirective } from '@angular/forms';
16+
import { ReadOnlyFormFieldComponent } from '../readonly-form-field/readonly-form-field.component';
17+
import { NgIf } from '@angular/common';
18+
import { ObserversModule } from '@angular/cdk/observers';
1919

2020
/**
2121
* Wraps a mat-form-field to replace it by a readOnly representation if necessary

projects/material-addons/src/lib/stepper/step-header/step-header.component.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.header {
22
overflow: hidden;
3-
outline: var(--warn-color);
3+
outline: var(--error-color);
44
cursor: pointer;
55
box-sizing: content-box;
66
-webkit-tap-highlight-color: transparent;
@@ -26,7 +26,7 @@
2626

2727
.step-state-error {
2828
width: 5px;
29-
background: var(--warn-color);
29+
background: var(--error-color);
3030
}
3131

3232
.step-state-neutral {
@@ -39,13 +39,13 @@
3939
}
4040

4141
.red-error {
42-
color: var(--warn-color);
42+
color: var(--error-color);
4343
}
4444

4545
.check-border {
4646
border-color: #d3d3d3;
4747
}
4848

4949
.error-border {
50-
border-color: var(--warn-color);
50+
border-color: var(--error-color);
5151
}

projects/material-addons/src/lib/stepper/stepper.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[attr.aria-labelledby]="_getStepLabelId(i)"
1313
[attr.aria-expanded]="selectedIndex === i"
1414
>
15-
<div data-cy="stepper-content" class="vertical-content">
15+
<div data-cy="stepper-content">
1616
<ng-container
1717
[ngTemplateOutlet]="step.content"
1818
[ngTemplateOutletContext]="{

projects/material-addons/src/lib/stepper/stepper.component.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
outline: 0;
2828
}
2929

30-
.vertical-content {
31-
padding: 0 24px 0 24px;
32-
}
33-
3430
.step-container {
3531
border-left: 1px solid lightgrey;
3632
border-right: 1px solid lightgrey;

projects/material-addons/src/themes/common/styles.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $default-palette: (
4949
$table-hover-color: theme.get-table-hover-color($main-primary);
5050
$background-color: theme.get-background-color();
5151
$warn-color: map-get(theme.$primary-palette, warn-color);
52+
$error-color: map-get(theme.$primary-palette, error-color);
5253
$hover-color: map-get(theme.$primary-palette, 50);
5354
$panel-color: map-get(theme.$primary-palette, 900);
5455
$panel-background-color: theme.map-get-or-default(theme.$primary-palette, panel-background-color);
@@ -82,6 +83,7 @@ $default-palette: (
8283
--hover-color: #{$hover-color};
8384
--table-hover-color: #{$table-hover-color};
8485
--warn-color: #{$warn-color};
86+
--error-color: #{$error-color};
8587
--background-color: #{$background-color};
8688
--panel-color: #{$panel-color};
8789
--panel-background-color: #{$panel-background-color};

src/app/example-components/stepper/stepper.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
<mat-form-field>
66
<mat-label>Firstname</mat-label>
77
<input matInput placeholder="Firstname" formControlName="firstName" />
8+
<mat-error>Please enter a first name</mat-error>
89
</mat-form-field>
910
<mat-form-field>
1011
<mat-label>Lastname</mat-label>
1112
<input matInput placeholder="Lastname" formControlName="lastName" />
13+
<mat-error>Please enter a last name</mat-error>
1214
</mat-form-field>
1315
</div>
1416
</form>
@@ -19,10 +21,12 @@
1921
<mat-form-field>
2022
<mat-label>Email</mat-label>
2123
<input matInput placeholder="Firstname" formControlName="email" />
24+
<mat-error>Please enter an email</mat-error>
2225
</mat-form-field>
2326
<mat-form-field>
2427
<mat-label>Phone</mat-label>
2528
<input matInput placeholder="Lastname" formControlName="phone" />
29+
<mat-error>Please enter a phone number</mat-error>
2630
</mat-form-field>
2731
</div>
2832
</form>

0 commit comments

Comments
 (0)