-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from cal-smith/master
feat(toast): add toast banner
- Loading branch information
Showing
10 changed files
with
90 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:ibm/carbon-components-angular.git" | ||
"url": "[email protected]:IBM/carbon-components-angular.git" | ||
}, | ||
"license": "Apache-2", | ||
"author": "IBM", | ||
|
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 |
---|---|---|
|
@@ -24,6 +24,6 @@ if [[ $TRAVIS_BRANCH == "master" ]]; then | |
git init | ||
git add . | ||
git commit -m "Deploy to GitHub Pages" | ||
git push --force "[email protected]:ibm/carbon-components-angular.git" master:gh-pages > /dev/null 2>&1 | ||
git push --force "[email protected]:IBM/carbon-components-angular.git" master:gh-pages > /dev/null 2>&1 | ||
exit 0; | ||
fi |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
set -e | ||
|
||
[email protected]:ibm/carbon-components-angular.git | ||
[email protected]:IBM/carbon-components-angular.git | ||
|
||
npm run lint | ||
|
||
|
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 @@ | ||
export interface BannerContent { | ||
type: string; | ||
title: string; | ||
target?: string; | ||
duration?: number; | ||
smart?: boolean; | ||
} | ||
|
||
export interface NotificationContent extends BannerContent { | ||
message: string; | ||
} | ||
|
||
export interface ToastContent extends NotificationContent { | ||
subtitle: string; | ||
caption: string; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Component, Input } from "@angular/core"; | ||
|
||
import { Banner } from "./banner.component"; | ||
import { BannerService } from "./banner.service"; | ||
import { ToastContent } from "./banner-content.interface"; | ||
|
||
/** | ||
* Banner messages are displayed toward the top of the UI and do not interrupt user’s work. | ||
* | ||
* @export | ||
* @class Banner | ||
*/ | ||
@Component({ | ||
selector: "ibm-toast", | ||
template: ` | ||
<div | ||
#banner | ||
class="bx--toast-notification bx--toast-notification--{{bannerObj['type']}}" | ||
role="alert"> | ||
<div class="bx--toast-notification__details"> | ||
<h3 class="bx--toast-notification__title" [innerHTML]="bannerObj.title"></h3> | ||
<p class="bx--toast-notification__subtitle" [innerHTML]="bannerObj.subtitle"></p> | ||
<p class="bx--toast-notification__caption" [innerHTML]="bannerObj.caption"></p> | ||
</div> | ||
<button class="bx--toast-notification__close-button" type="button"> | ||
<svg | ||
class="bx--toast-notification-icon" | ||
aria-label="close" | ||
width="10" | ||
height="10" | ||
viewBox="0 0 10 10" | ||
xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M6.32 5L10 8.68 8.68 10 5 6.32 1.32 10 0 8.68 3.68 5 0 1.32 1.32 0 5 3.68 8.68 0 10 1.32 6.32 5z" fill-rule="nonzero"/> | ||
</svg> | ||
</button> | ||
</div> | ||
`, | ||
providers: [ BannerService ] | ||
}) | ||
export class Toast extends Banner { | ||
/** | ||
* Can have `type`, `title`, `subtitle`, and `caption` members. | ||
* | ||
* `type` can be one of `"info"`, `"warning"`, `"danger"`, `"success"` | ||
* | ||
* `message` is message for banner to display | ||
* | ||
*/ | ||
@Input() bannerObj: ToastContent; | ||
} |