Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(design): remove error message dependency on form-field #553

Merged
merged 2 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import '../../../../scss/daff-util';
@import '../../../scss/daff-util';

.daff-error-message {
:host {
display: block;
font-size: $small-font-size;
margin-top: 5px;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { DaffErrorMessageComponent } from './error-message.component';

describe('DaffErrorMessageComponent', () => {
let fixture: ComponentFixture<DaffErrorMessageComponent>;
let component: DaffErrorMessageComponent;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
DaffErrorMessageComponent
]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(DaffErrorMessageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';

@Component({
selector: 'daff-error-message',
template: '<ng-content></ng-content>',
styleUrls: ['./error-message.component.scss'],
host: {
'class': 'daff-error-message'
},
encapsulation: ViewEncapsulation.None
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DaffErrorMessageComponent {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Error Message Component

`daff-error-message` is a component that works alongside the the `daff-form-field` component to style and place the error message and its associated form control element appropriately.
# Error Message
`<daff-error-message>` is a component that works alongside the `<daff-form-field>` component to style and place the error message and its associated form control element appropriately.

## Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DaffErrorMessageComponent } from './error-message.component';

@NgModule({
exports: [
DaffErrorMessageComponent
],
declarations: [
DaffErrorMessageComponent
]
})
export class DaffErrorMessageModule { }
2 changes: 2 additions & 0 deletions libs/design/src/atoms/form/error-message/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { DaffErrorMessageModule } from './error-message.module';
export { DaffErrorMessageComponent } from './error-message.component';

This file was deleted.

10 changes: 5 additions & 5 deletions libs/design/src/atoms/form/form-field/form-field.module.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DaffFormFieldComponent } from './form-field/form-field.component';
import { DaffErrorMessageComponent } from './error-message/error-message.component';

import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { DaffErrorMessageModule } from '../error-message/error-message.module';

@NgModule({
imports: [
CommonModule,

FontAwesomeModule
FontAwesomeModule,
DaffErrorMessageModule
],
exports: [
DaffFormFieldComponent,
DaffErrorMessageComponent
DaffErrorMessageModule
],
declarations: [
DaffFormFieldComponent,
DaffErrorMessageComponent
DaffFormFieldComponent
]
})
export class DaffFormFieldModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { By } from '@angular/platform-browser';
import { ReactiveFormsModule, FormControl, Validators } from '@angular/forms';

import { DaffFormFieldComponent } from './form-field.component';
import { DaffErrorMessageComponent } from '../error-message/error-message.component';
import { DaffErrorMessageComponent } from '../../error-message/error-message.component';
import { DaffFormFieldMissingControlMessage } from '../form-field-errors';
import { DaffFormFieldControl } from '../form-field-control';
import { DaffInputModule } from '../../input/public_api';
Expand Down
1 change: 0 additions & 1 deletion libs/design/src/atoms/form/form-field/public_api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { DaffFormFieldModule } from './form-field.module';
export * from './form-field/form-field.component';
export { DaffFormFieldControl } from './form-field-control';
export * from './error-message/error-message.component';
2 changes: 1 addition & 1 deletion libs/design/src/scss/theming/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '../../atoms/button/button-theme';
@import '../../atoms/form/form-field/error-message/error-message-theme';
@import '../../atoms/form/error-message/error-message-theme';
@import '../../atoms/form/form-field/form-field/form-field-theme';
@import '../../atoms/form/input/input/input-theme';
@import '../../atoms/form/select/select/select-theme';
Expand Down