-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: introduce message strip and depricate alerts (#2258)
* fix: introduce message strip and depricate alerts * add types to the doc * add fixes related to PR review * update package-lock.json * update package-lock.json * update package-lock * add package.json and package-lock.json * fix tests * run all tests Co-authored-by: Mike O'Donnell <mikerodonnell89@users.noreply.github.com>
- Loading branch information
1 parent
3bf3adf
commit dde194f
Showing
35 changed files
with
592 additions
and
14 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
3 changes: 3 additions & 0 deletions
3
apps/docs/src/app/core/component-docs/alert/alert-header/alert-header.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
15 changes: 15 additions & 0 deletions
15
...s/src/app/core/component-docs/message-strip/examples/message-strip-example.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,15 @@ | ||
<fd-message-strip [type]="'warning'"> | ||
A dismissible warning message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'success'" [dismissible]="false" > | ||
A non-dismissible success message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'information'"> | ||
A dismissible information message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'error'" [dismissible]="false"> | ||
A non-dismissible error message strip. | ||
</fd-message-strip> | ||
<fd-message-strip> | ||
A dismissible normal message strip. | ||
</fd-message-strip> |
6 changes: 6 additions & 0 deletions
6
...s/src/app/core/component-docs/message-strip/examples/message-strip-example.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 @@ | ||
fd-message-strip { | ||
margin-bottom: 12px; | ||
} | ||
fd-message-strip:last-child { | ||
margin: 0; | ||
} |
8 changes: 8 additions & 0 deletions
8
...ocs/src/app/core/component-docs/message-strip/examples/message-strip-example.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: 'fd-message-strip-example', | ||
templateUrl: './message-strip-example.component.html', | ||
styleUrls: ['message-strip-example.component.scss'] | ||
}) | ||
export class MessageStripExampleComponent { } |
12 changes: 12 additions & 0 deletions
12
...pp/core/component-docs/message-strip/examples/message-strip-noicon-example.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,12 @@ | ||
<fd-message-strip [type]="'warning'" [noIcon]="true"> | ||
A dismissible warning message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'success'" [dismissible]="false" [noIcon]="true"> | ||
A non-dismissible success message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'information'" [noIcon]="true"> | ||
A dismissible information message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'error'" [dismissible]="false" [noIcon]="true"> | ||
A non-dismissible error message strip. | ||
</fd-message-strip> |
8 changes: 8 additions & 0 deletions
8
.../app/core/component-docs/message-strip/examples/message-strip-noicon-example.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: 'fd-message-strip-noicon-example', | ||
templateUrl: './message-strip-noicon-example.component.html', | ||
styleUrls: ['message-strip-example.component.scss'] | ||
}) | ||
export class MessageStripNoIconExampleComponent { } |
15 changes: 15 additions & 0 deletions
15
...app/core/component-docs/message-strip/examples/message-strip-width-example.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,15 @@ | ||
<fd-message-strip [type]="'warning'" [noIcon]="true" [minWidth]="'400px'"> | ||
A dismissible warning message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'success'" [dismissible]="false" [width]="'70%'" > | ||
A non-dismissible success message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'information'" [width]="'50%'"> | ||
A dismissible information message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [type]="'error'" [dismissible]="false" [width]="'400px'"> | ||
A non-dismissible error message strip. | ||
</fd-message-strip> | ||
<fd-message-strip [width]="'300px'"> | ||
A dismissible normal message strip. | ||
</fd-message-strip> |
8 changes: 8 additions & 0 deletions
8
...c/app/core/component-docs/message-strip/examples/message-strip-width-example.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: 'fd-message-strip-width-example', | ||
templateUrl: './message-strip-width-example.component.html', | ||
styleUrls: ['message-strip-example.component.scss'] | ||
}) | ||
export class MessageStripWidthExampleComponent { } |
42 changes: 42 additions & 0 deletions
42
apps/docs/src/app/core/component-docs/message-strip/message-strip-docs.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,42 @@ | ||
<fd-docs-section-title [id]="'message-strip-basic'" [componentName]="'messageStrip'"> | ||
Message Strip Types | ||
</fd-docs-section-title> | ||
<description>A number of message strip types are available. They offer preset styling for different contextual situations. Can be one of 'warning', 'success', 'information', 'error' or normal (default). </description> | ||
<component-example> | ||
<fd-message-strip-example></fd-message-strip-example> | ||
</component-example> | ||
<code-example [exampleFiles]="messageStripBasicExample"></code-example> | ||
|
||
<separator></separator> | ||
|
||
<fd-docs-section-title [id]="'message-strip-no-icon'" [componentName]="'messageStrip'"> | ||
Message Strips Without Icons | ||
</fd-docs-section-title> | ||
<description>The default message strip has no icon. Information, Success, Warning and Error message strips by default are rendered with icons. To remove them set the <code>[noIcon]</code> property to <code>true</code>. </description> | ||
<component-example> | ||
<fd-message-strip-noicon-example></fd-message-strip-noicon-example> | ||
</component-example> | ||
<code-example [exampleFiles]="messageStripNoIconExample"></code-example> | ||
|
||
<separator></separator> | ||
|
||
<fd-docs-section-title [id]="'message-strip-width'" [componentName]="'messageStrip'"> | ||
Message Strips With Customizable Width | ||
</fd-docs-section-title> | ||
<description>The width of the message strip can be customized by the <code>[width]</code> and <code>[minWidth]</code> properties. </description> | ||
<component-example> | ||
<fd-message-strip-width-example></fd-message-strip-width-example> | ||
</component-example> | ||
<code-example [exampleFiles]="messageStripWidthExample"></code-example> | ||
|
||
<playground [schema]="schema" [schemaInitialValues]="data" (onFormChanges)="onSchemaValues($event)"> | ||
<fd-message-strip | ||
[type]="data.modifier.type" | ||
[dismissible]="data.properties.dismissible" | ||
[noIcon]="data.properties.noIcon" | ||
[width]="data.properties.width" | ||
> | ||
{{data.properties.message}} | ||
</fd-message-strip> | ||
</playground> | ||
|
98 changes: 98 additions & 0 deletions
98
apps/docs/src/app/core/component-docs/message-strip/message-strip-docs.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,98 @@ | ||
import { Component } from '@angular/core'; | ||
import { Schema } from '../../../schema/models/schema.model'; | ||
import { SchemaFactoryService } from '../../../schema/services/schema-factory/schema-factory.service'; | ||
import * as messageStripExampleHtml from '!raw-loader!./examples/message-strip-example.component.html'; | ||
import * as messageStripExampleScs from '!raw-loader!./examples/message-strip-example.component.scss'; | ||
import * as messageStripNoIconExampleHtml from '!raw-loader!./examples/message-strip-noicon-example.component.html'; | ||
import * as messageStripWidthExampleHtml from '!raw-loader!./examples/message-strip-width-example.component.html'; | ||
|
||
import { ExampleFile } from '../../../documentation/core-helpers/code-example/example-file'; | ||
|
||
@Component({ | ||
selector: 'app-message-strip', | ||
templateUrl: './message-strip-docs.component.html', | ||
}) | ||
export class MessageStripDocsComponent { | ||
static schema: any = { | ||
properties: { | ||
properties: { | ||
type: 'object', | ||
properties: { | ||
dismissible: { | ||
type: 'boolean' | ||
}, | ||
noIcon: { | ||
type: 'boolean' | ||
}, | ||
width: { | ||
type: 'string' | ||
}, | ||
message: { | ||
type: 'string' | ||
} | ||
} | ||
}, | ||
modifier: { | ||
type: 'object', | ||
properties: { | ||
type: { | ||
type: 'string', | ||
enum: ['default', 'warning', 'error', 'success', 'information'] | ||
} | ||
} | ||
} | ||
}, | ||
type: 'object' | ||
}; | ||
|
||
data: any = { | ||
properties: { | ||
dismissible: true, | ||
noIcon: false, | ||
width: '100%', | ||
message: 'This is a message strip message.', | ||
}, | ||
modifier: { | ||
type: 'default' | ||
} | ||
}; | ||
|
||
messageStripBasicExample: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
scssFileCode: messageStripExampleScs, | ||
fileName: 'message-strip-example', | ||
code: messageStripExampleHtml, | ||
}, | ||
]; | ||
|
||
messageStripNoIconExample: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
scssFileCode: messageStripExampleScs, | ||
fileName: 'message-strip-noicon-example', | ||
code: messageStripNoIconExampleHtml, | ||
}, | ||
]; | ||
|
||
messageStripWidthExample: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
scssFileCode: messageStripExampleScs, | ||
fileName: 'message-strip-width-example', | ||
code: messageStripWidthExampleHtml, | ||
}, | ||
]; | ||
|
||
schema: Schema; | ||
|
||
constructor( | ||
private schemaFactory: SchemaFactoryService | ||
) { | ||
this.schema = this.schemaFactory.getComponent('messageStrip'); | ||
} | ||
|
||
onSchemaValues(data) { | ||
this.data = data; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
apps/docs/src/app/core/component-docs/message-strip/message-strip-docs.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,40 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { ApiComponent } from '../../../documentation/core-helpers/api/api.component'; | ||
import { API_FILES } from '../../api-files'; | ||
import { SharedDocumentationModule } from '../../../documentation/shared-documentation.module'; | ||
import { MessageStripDocsComponent } from './message-strip-docs.component'; | ||
import { MessageStripExampleComponent } from './examples/message-strip-example.component'; | ||
import { MessageStripNoIconExampleComponent } from './examples/message-strip-noicon-example.component'; | ||
import { MessageStripWidthExampleComponent } from './examples/message-strip-width-example.component'; | ||
import { MessageStripHeaderComponent } from './message-strip-header/message-strip-header.component'; | ||
import { MessageStripModule } from '@fundamental-ngx/core'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: MessageStripHeaderComponent, | ||
children: [ | ||
{ path: '', component: MessageStripDocsComponent }, | ||
{ path: 'api', component: ApiComponent, data: { content: API_FILES.messageStrip } } | ||
] | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(routes), | ||
SharedDocumentationModule, | ||
MessageStripModule | ||
], | ||
exports: [RouterModule], | ||
declarations: [ | ||
MessageStripHeaderComponent, | ||
MessageStripDocsComponent, | ||
MessageStripExampleComponent, | ||
MessageStripNoIconExampleComponent, | ||
MessageStripWidthExampleComponent | ||
] | ||
}) | ||
export class MessageStripDocsModule { | ||
} |
6 changes: 6 additions & 0 deletions
6
...ore/component-docs/message-strip/message-strip-header/message-strip-header.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,6 @@ | ||
<header>Message Strip</header> | ||
<description>Message Strips provide inline messages within the application that are color-coded to emphasize the level of urgency.</description> | ||
<import module="MessageStripModule"></import> | ||
|
||
<fd-header-tabs></fd-header-tabs> | ||
<router-outlet></router-outlet> |
9 changes: 9 additions & 0 deletions
9
.../core/component-docs/message-strip/message-strip-header/message-strip-header.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,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'fd-message-strip-header', | ||
templateUrl: './message-strip-header.component.html' | ||
}) | ||
export class MessageStripHeaderComponent { | ||
|
||
} |
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
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
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
Oops, something went wrong.