-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): create notification component (#2484)
- Loading branch information
Showing
47 changed files
with
1,143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
apps/design-land/src/app/notification/notification-routing-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { | ||
Routes, | ||
RouterModule, | ||
} from '@angular/router'; | ||
|
||
import { DesignLandNotificationComponent } from './notification.component'; | ||
|
||
export const notificationRoutes: Routes = [ | ||
{ path: '', component: DesignLandNotificationComponent }, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(notificationRoutes), | ||
], | ||
exports: [ | ||
RouterModule, | ||
], | ||
}) | ||
export class DesignLandNotificationRoutingModule {} |
17 changes: 17 additions & 0 deletions
17
apps/design-land/src/app/notification/notification.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<h1 daffArticleTitle>Notification</h1> | ||
<p daffArticleLead>Notifications provides a way to display and communicate information related user actions within a page's content.</p> | ||
|
||
<h2>Overview</h2> | ||
<p>Notifications are used to display short messages that provide context in close promixity to a piece of content. They're often used to provide feedback or to notify users about an action they performed within a page. Notifications should not be used to display app-level alerts. Instead, use the <a routerLink="/toast">Toast</a> component.</p> | ||
|
||
<h3>Default notification</h3> | ||
<design-land-example-viewer-container example="default-notification"></design-land-example-viewer-container> | ||
|
||
<h3>Dismissable notification</h3> | ||
<design-land-example-viewer-container example="dismissable-notification"></design-land-example-viewer-container> | ||
|
||
<h3>Notification Statuses</h3> | ||
<design-land-example-viewer-container example="notification-status"></design-land-example-viewer-container> | ||
|
||
<h3>Notification Orientations</h3> | ||
<design-land-example-viewer-container example="notification-orientations"></design-land-example-viewer-container> |
Empty file.
29 changes: 29 additions & 0 deletions
29
apps/design-land/src/app/notification/notification.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
ComponentFixture, | ||
TestBed, | ||
waitForAsync, | ||
} from '@angular/core/testing'; | ||
|
||
import { DesignLandNotificationComponent } from './notification.component'; | ||
|
||
describe('DesignLandNotificationComponent', () => { | ||
let component: DesignLandNotificationComponent; | ||
let fixture: ComponentFixture<DesignLandNotificationComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DesignLandNotificationComponent ], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DesignLandNotificationComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
8 changes: 8 additions & 0 deletions
8
apps/design-land/src/app/notification/notification.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'design-land-notification', | ||
templateUrl: './notification.component.html', | ||
styleUrls: ['./notification.component.scss'], | ||
}) | ||
export class DesignLandNotificationComponent {} |
28 changes: 28 additions & 0 deletions
28
apps/design-land/src/app/notification/notification.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { DaffArticleModule } from '@daffodil/design'; | ||
import { DaffNotificationModule } from '@daffodil/design/notification'; | ||
|
||
import { DesignLandExampleViewerModule } from '../core/code-preview/container/example-viewer.module'; | ||
import { DesignLandNotificationRoutingModule } from './notification-routing-module'; | ||
import { DesignLandNotificationComponent } from './notification.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DesignLandNotificationComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
RouterModule, | ||
DesignLandNotificationRoutingModule, | ||
DesignLandExampleViewerModule, | ||
|
||
DaffArticleModule, | ||
DaffNotificationModule, | ||
], | ||
}) | ||
export class DesignLandNotificationModule { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Notifications | ||
Notifications provides a way to display and communicate information for user actions or system updates. There are two main types of notifications — inline or toast. | ||
|
||
## Usage | ||
``` | ||
<h4>Default Message Bar</h4> | ||
<daff-notification> | ||
Default Message Bar | ||
</daff-notification> | ||
<h4>Message Bar Statuses</h4> | ||
<daff-notification status="warn"> | ||
Message Bar - Primary Color | ||
</daff-notification> | ||
<daff-notification status="error"> | ||
Message Bar - Secondary Color | ||
</daff-notification> | ||
<daff-notification status="success"> | ||
Message Bar - Secondary Color | ||
</daff-notification> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/design/examples", | ||
"deleteDestPath": false, | ||
"lib": { | ||
"entryFile": "src/index.ts", | ||
"styleIncludePaths": ["../../scss"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "@daffodil/design/notification/examples" | ||
} |
8 changes: 8 additions & 0 deletions
8
...design/notification/examples/src/default-notification/default-notification.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<daff-notification> | ||
<fa-icon daffPrefix [icon]="faInfoCircle"></fa-icon> | ||
<div daffNotificationTitle>Title</div> | ||
<div daffNotificationSubtitle>This is the subtitle with information</div> | ||
<div daffNotificationActions> | ||
<button daff-button size="sm">Confirm</button> | ||
</div> | ||
</daff-notification> |
21 changes: 21 additions & 0 deletions
21
libs/design/notification/examples/src/default-notification/default-notification.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'default-notification', | ||
templateUrl: './default-notification.component.html', | ||
styles: [` | ||
:host { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
`], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DefaultNotificationComponent { | ||
faInfoCircle = faInfoCircle; | ||
} |
24 changes: 24 additions & 0 deletions
24
libs/design/notification/examples/src/default-notification/default-notification.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; | ||
|
||
import { DaffButtonModule } from '@daffodil/design'; | ||
import { DaffNotificationModule } from '@daffodil/design/notification'; | ||
|
||
import { DefaultNotificationComponent } from './default-notification.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DefaultNotificationComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
DaffNotificationModule, | ||
FontAwesomeModule, | ||
DaffButtonModule, | ||
], | ||
exports: [ | ||
DefaultNotificationComponent, | ||
], | ||
}) | ||
export class DefaultNotificationModule { } |
5 changes: 5 additions & 0 deletions
5
...otification/examples/src/dismissable-notification/dismissable-notification.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<daff-notification dismissable="true"> | ||
<fa-icon daffPrefix [icon]="faInfoCircle"></fa-icon> | ||
<div daffNotificationTitle>Title</div> | ||
<div daffNotificationSubtitle>This is the subtitle with information</div> | ||
</daff-notification> |
21 changes: 21 additions & 0 deletions
21
.../notification/examples/src/dismissable-notification/dismissable-notification.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'dismissable-notification', | ||
templateUrl: './dismissable-notification.component.html', | ||
styles: [` | ||
:host { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
`], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DismissableNotificationComponent { | ||
faInfoCircle = faInfoCircle; | ||
} |
24 changes: 24 additions & 0 deletions
24
...ign/notification/examples/src/dismissable-notification/dismissable-notification.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; | ||
|
||
import { DaffButtonModule } from '@daffodil/design'; | ||
import { DaffNotificationModule } from '@daffodil/design/notification'; | ||
|
||
import { DismissableNotificationComponent } from './dismissable-notification.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DismissableNotificationComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
DaffNotificationModule, | ||
FontAwesomeModule, | ||
DaffButtonModule, | ||
], | ||
exports: [ | ||
DismissableNotificationComponent, | ||
], | ||
}) | ||
export class DismissableNotificationModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './public_api'; |
13 changes: 13 additions & 0 deletions
13
...ification/examples/src/notification-orientations/notification-orientations.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<daff-notification [orientation]="orientationControl.value"> | ||
<fa-icon daffPrefix [icon]="faCheck" [fixedWidth]="true"></fa-icon> | ||
<div daffNotificationTitle>Title</div> | ||
<div daffNotificationSubtitle>This is the subtitle with information</div> | ||
<div daffNotificationActions> | ||
<button daff-button size="sm" color="theme-contrast">Confirm</button> | ||
</div> | ||
</daff-notification> | ||
|
||
<select [formControl]="orientationControl"> | ||
<option value="vertical">Vertical</option> | ||
<option value="horizontal">Horizontal</option> | ||
</select> |
6 changes: 6 additions & 0 deletions
6
...ification/examples/src/notification-orientations/notification-orientations.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 16px; | ||
} |
25 changes: 25 additions & 0 deletions
25
...otification/examples/src/notification-orientations/notification-orientations.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
import { FormControl } from '@angular/forms'; | ||
import { | ||
faCheck, | ||
faExclamation, | ||
faInfoCircle, | ||
} from '@fortawesome/free-solid-svg-icons'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'notification-orientations', | ||
templateUrl: './notification-orientations.component.html', | ||
styleUrls: ['./notification-orientations.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class NotificationOrientationsComponent { | ||
faInfoCircle = faInfoCircle; | ||
faCheck = faCheck; | ||
faExclamation = faExclamation; | ||
|
||
orientationControl: FormControl = new FormControl('vertical'); | ||
} |
26 changes: 26 additions & 0 deletions
26
...n/notification/examples/src/notification-orientations/notification-orientations.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; | ||
|
||
import { DaffButtonModule } from '@daffodil/design'; | ||
import { DaffNotificationModule } from '@daffodil/design/notification'; | ||
|
||
import { NotificationOrientationsComponent } from './notification-orientations.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
NotificationOrientationsComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
DaffNotificationModule, | ||
DaffButtonModule, | ||
FontAwesomeModule, | ||
ReactiveFormsModule, | ||
], | ||
exports: [ | ||
NotificationOrientationsComponent, | ||
], | ||
}) | ||
export class NotificationOrientationsModule { } |
16 changes: 16 additions & 0 deletions
16
libs/design/notification/examples/src/notification-status/notification-status.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<daff-notification [status]="statusControl.value"> | ||
<fa-icon *ngIf="statusControl.value === 'success'" daffPrefix [icon]="faCheck" [fixedWidth]="true"></fa-icon> | ||
<fa-icon *ngIf="statusControl.value === 'warn'" daffPrefix [icon]="faExclamation" [fixedWidth]="true"></fa-icon> | ||
<fa-icon *ngIf="statusControl.value === 'error'" daffPrefix [icon]="faExclamation" [fixedWidth]="true"></fa-icon> | ||
<div daffNotificationTitle>Title</div> | ||
<div daffNotificationSubtitle>This is the subtitle with information</div> | ||
<div daffNotificationActions> | ||
<button daff-button size="sm" color="theme-contrast">Confirm</button> | ||
</div> | ||
</daff-notification> | ||
|
||
<select [formControl]="statusControl"> | ||
<option value="success">Success</option> | ||
<option value="warn">Warn</option> | ||
<option value="error">Error</option> | ||
</select> |
Oops, something went wrong.