-
Notifications
You must be signed in to change notification settings - Fork 357
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(message): introducing message
module. (closes #316)
#596
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ba8b49e
feat(message): introducing `message` module
8b33360
chore(message): add initial unit tests
4786b31
update(message): change to display none for toggle
17fc801
update(docs): overview & nav for messages
3cd677a
update(demo): message component demo
16f1c60
fix(message): initialize flag not set in some cases
emoralesb05 facd672
fix(): lint error
emoralesb05 94f63c2
chore(): change wording in README.md
emoralesb05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
118 changes: 118 additions & 0 deletions
118
src/app/components/components/message/message.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,118 @@ | ||
<md-card> | ||
<md-card-title>Messages & Alerts</md-card-title> | ||
<md-card-subtitle>Info, warning & alert messages</md-card-subtitle> | ||
<md-divider></md-divider> | ||
<md-tab-group md-stretch-tabs dynamicHeight> | ||
<md-tab> | ||
<ng-template md-tab-label>Demo</ng-template> | ||
<md-card-content> | ||
<p class="md-body-1">Standalone message:</p> | ||
<td-message label="Error!" sublabel="You did something wrong!" color="warn" icon="error"></td-message> | ||
<p class="md-body-1">Message in a card with action</p> | ||
<md-card> | ||
<td-message label="Warning!" sublabel="Your probably shouldn't do that!" color="primary" icon="warning"> | ||
<button td-message-actions md-button>VIEW MORE</button> | ||
</td-message> | ||
</md-card> | ||
<p class="md-body-1">Message in a card content:</p> | ||
<md-card> | ||
<md-card-title>Card title</md-card-title> | ||
<md-divider></md-divider> | ||
<td-message label="Info" sublabel="Maybe you want to know this" color="accent" icon="info"></td-message> | ||
<md-card-content> | ||
content | ||
</md-card-content> | ||
</md-card> | ||
<p class="md-body-1">Toggle visibility:</p> | ||
<td-message #messageDemo color="primary" class="pad-sm" label="Hide me!" sublabel="You can toggle my visibility & add a class!"> | ||
<button td-message-actions md-icon-button (click)="messageDemo.close()"><md-icon>cancel</md-icon></button> | ||
</td-message> | ||
</md-card-content> | ||
</md-tab> | ||
<md-tab> | ||
<ng-template md-tab-label>Code</ng-template> | ||
<md-card-content> | ||
<p>HTML:</p> | ||
<td-highlight lang="html"> | ||
<![CDATA[ | ||
<p class="md-body-1">Standalone message:</p> | ||
<td-message label="Error!" sublabel="You did something wrong!" color="warn" icon="error"></td-message> | ||
<p class="md-body-1">Message in a card with action</p> | ||
<md-card> | ||
<td-message label="Warning!" sublabel="Your probably shouldn't do that!" color="primary" icon="warning"> | ||
<button td-message-actions md-button>VIEW MORE</button> | ||
</td-message> | ||
</md-card> | ||
<p class="md-body-1">Message in a card content:</p> | ||
<md-card> | ||
<md-card-title>Card title</md-card-title> | ||
<md-divider></md-divider> | ||
<td-message label="Info" sublabel="Maybe you want to know this" color="accent" icon="info"></td-message> | ||
<md-card-content> | ||
content | ||
</md-card-content> | ||
</md-card> | ||
<p class="md-body-1">Toggle visibility:</p> | ||
<td-message #messageDemo color="primary" class="pad-sm" label="Hide me!" sublabel="You can toggle my visibility & add a class!"> | ||
<button td-message-actions md-icon-button (click)="messageDemo.close()"><md-icon>cancel</md-icon></button> | ||
</td-message> | ||
<button md-button color="accent" (click)="messageDemo.toggle()"> | ||
Toggle Visibility | ||
</button> | ||
]]> | ||
</td-highlight> | ||
</md-card-content> | ||
</md-tab> | ||
</md-tab-group> | ||
<md-divider></md-divider> | ||
<md-card-actions> | ||
<button md-button color="accent" class="text-upper" (click)="messageDemo.toggle()"> | ||
Toggle Visibility | ||
</button> | ||
</md-card-actions> | ||
</md-card> | ||
<md-card> | ||
<md-card-title>Material Colored Messages</md-card-title> | ||
<md-card-subtitle>Use the full Material Design color palette</md-card-subtitle> | ||
<md-divider></md-divider> | ||
<md-tab-group md-stretch-tabs dynamicHeight> | ||
<md-tab> | ||
<ng-template md-tab-label>Demo</ng-template> | ||
<md-card-content> | ||
<p class="md-body-1">Using <code>color</code>:</p> | ||
<td-message label="Purple!" sublabel="Simply add color=blah" color="purple" icon="error"> | ||
<button td-message-actions md-button>VIEW MORE</button> | ||
</td-message> | ||
<p class="md-body-1">Using <code>class</code>:</p> | ||
<td-message label="Cyan!" sublabel="Reference the Covalent style guide" class="bgc-cyan-800 tc-cyan-100" icon="error"> | ||
<button td-message-actions md-button>VIEW MORE</button> | ||
</td-message> | ||
</md-card-content> | ||
</md-tab> | ||
<md-tab> | ||
<ng-template md-tab-label>Code</ng-template> | ||
<md-card-content> | ||
<p>HTML:</p> | ||
<td-highlight lang="html"> | ||
<![CDATA[ | ||
<p class="md-body-1">Using <code>color</code>:</p> | ||
<td-message label="Purple!" sublabel="Simply add color=blah" color="purple" icon="error"> | ||
<button td-message-actions md-button>VIEW MORE</button> | ||
</td-message> | ||
<p class="md-body-1">Using <code>class</code>:</p> | ||
<td-message label="Cyan!" sublabel="Reference the Covalent style guide" class="bgc-cyan-800 tc-cyan-100" icon="error"> | ||
<button td-message-actions md-button>VIEW MORE</button> | ||
</td-message> | ||
]]> | ||
</td-highlight> | ||
</md-card-content> | ||
</md-tab> | ||
</md-tab-group> | ||
<md-divider></md-divider> | ||
<md-card-actions> | ||
<a md-button color="accent" class="text-upper" [routerLink]="['/style-guide/colors']"> | ||
Color Guide | ||
</a> | ||
</md-card-actions> | ||
</md-card> | ||
<td-readme-loader resourceUrl="platform/core/message/README.md"></td-readme-loader> |
Empty file.
15 changes: 15 additions & 0 deletions
15
src/app/components/components/message/message.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,15 @@ | ||
import { Component, HostBinding } from '@angular/core'; | ||
import { slideInDownAnimation } from '../../../app.animations'; | ||
|
||
@Component({ | ||
selector: 'message-demo', | ||
styleUrls: ['./message.component.scss' ], | ||
templateUrl: './message.component.html', | ||
animations: [slideInDownAnimation], | ||
}) | ||
export class MessageDemoComponent { | ||
|
||
@HostBinding('@routeAnimation') routeAnimation: boolean = true; | ||
@HostBinding('class.td-route-animation') classAnimation: boolean = true; | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# td-message | ||
|
||
`td-message` element generates an inline message with an icon, color, label and sublabel. | ||
|
||
`color` can be either with any theme color (`primary`, `accent` or `warn`) | ||
But you can also set a `color` from our lib can be applied in the component to get any material color not in the theme. (`blue`, `red`, etc) | ||
|
||
## API Summary | ||
|
||
Properties: | ||
|
||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
| `label?` | `string` | Sets the label of the message. | ||
| `sublabel?` | `string` | Sets the sublabel of the message. | ||
| `icon?` | `string` | The icon to be displayed before the title. Defaults to `info_outline` icon | ||
| `color?` | `'primary', 'accent' or 'warn'` | Sets the color of the message. Can also use any material color: `purple`, `light-blue`, etc. | ||
| `opened?` | `boolean` | Shows or hiddes the message depending on its value. Defaults to 'true'. | ||
| `open` | `function()` | Renders the message on screen. | ||
| `close` | `function()` | Removes the message content from screen. | ||
| `toggle` | `function()` | Toggles between open and close depending on state. | ||
|
||
## Setup | ||
|
||
Import the [CovalentMessageModule] in your NgModule: | ||
|
||
```typescript | ||
import { CovalentMessageModule } from '@covalent/core'; | ||
@NgModule({ | ||
imports: [ | ||
CovalentMessageModule, | ||
... | ||
], | ||
... | ||
}) | ||
export class MyModule {} | ||
``` | ||
|
||
## Usage | ||
|
||
Example for HTML usage: | ||
|
||
```html | ||
<td-message #message label="Label" sublabel="Sublabel goes here" icon="warning" color="primary | blue | red" [opened]="true"> | ||
<button td-message-actions md-button>View More<button> | ||
<button td-message-actions md-button (click)="message.close()">Close<button> | ||
// .. body goes here | ||
</td-message> | ||
``` |
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,22 @@ | ||
@import '../common/styles/theme-functions'; | ||
|
||
@mixin td-message-theme($theme) { | ||
$primary: map-get($theme, primary); | ||
$accent: map-get($theme, accent); | ||
$warn: map-get($theme, warn); | ||
|
||
.td-message { | ||
&.mat-primary { | ||
color: mat-color($primary); | ||
background-color: mat-color($primary, 0.15); | ||
} | ||
&.mat-accent { | ||
color: mat-color($accent); | ||
background-color: mat-color($accent, 0.15); | ||
} | ||
&.mat-warn { | ||
color: mat-color($warn); | ||
background-color: mat-color($warn, 0.15); | ||
} | ||
} | ||
} |
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 @@ | ||
<div tdMessageContainer></div> | ||
<ng-template> | ||
<div class="pad-left pad-right td-message-wrapper" layout="row" layout-align="center center"> | ||
<md-icon class="push-right">{{icon}}</md-icon> | ||
<div> | ||
<div *ngIf="label" class="td-message-label md-body-2">{{label}}</div> | ||
<div *ngIf="sublabel" class="td-message-sublabel md-body-1">{{sublabel}}</div> | ||
</div> | ||
<span flex></span> | ||
<ng-content select="[td-message-actions]"></ng-content> | ||
</div> | ||
</ng-template> |
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: block; | ||
.td-message-wrapper { | ||
min-height: 52px; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean:
But you can also set a
color
from our lib and it can be applied in the component to get any material color not in the theme. (blue
,red
, etc)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated~