Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Contrib > Toast Component #1676

Merged
merged 69 commits into from
May 21, 2018
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3f4222e
Resolving Card action bar still visable after hiding with *ngIf #1421
blackbaud-conorwright Mar 7, 2018
a450054
Addressed PR style comments
blackbaud-conorwright Mar 8, 2018
4b809aa
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 9, 2018
d55f351
Merge branch 'master' into master
Blackbaud-SteveBrush Mar 9, 2018
833bcc7
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 12, 2018
b553659
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 15, 2018
ab82ba3
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 19, 2018
db21c76
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 27, 2018
a282a86
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 30, 2018
995f024
started porting over alert design to toast
blackbaud-conorwright Apr 3, 2018
f4c10f0
began working on toast component from scratch
blackbaud-conorwright Apr 4, 2018
c8994ae
got a base demo and toast service running
blackbaud-conorwright Apr 4, 2018
d210c2b
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 10, 2018
11ab289
Merge remote-tracking branch 'origin/master' into toastr-fromscratch
blackbaud-conorwright Apr 10, 2018
a49ebf3
Got the base toast service functional
blackbaud-conorwright Apr 10, 2018
28c09b6
moved the toaster to the bottom right
blackbaud-conorwright Apr 10, 2018
3b5d5cb
Steve's comments. Added fading close to toasts
blackbaud-conorwright Apr 10, 2018
35de170
styled the toast demo button
blackbaud-conorwright Apr 10, 2018
ce8ba62
fleshed out an initial structure for templated toasts
blackbaud-conorwright Apr 11, 2018
bc37187
implemented templated toast demo
blackbaud-conorwright Apr 11, 2018
82c286d
fixed hiding issue with templated toasts
blackbaud-conorwright Apr 11, 2018
52f7983
removed timeout. removed custom toast directive.
blackbaud-conorwright Apr 12, 2018
692cbf0
finished templating functionality.added types to demo
blackbaud-conorwright Apr 12, 2018
803a205
finished up the base set of unit testing
blackbaud-conorwright Apr 16, 2018
ed4558f
fixed import to target core.ts
blackbaud-conorwright Apr 17, 2018
35e789d
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 17, 2018
8c8f6c2
Merge remote-tracking branch 'origin/master' into toastr-fromscratch
blackbaud-conorwright Apr 17, 2018
a4f23b3
add visual tests for toast service
blackbaud-conorwright Apr 17, 2018
7d3458f
fixed style issues with toast component
blackbaud-conorwright Apr 17, 2018
03c63ae
expanded test coverage of the toast component
blackbaud-conorwright Apr 18, 2018
a37b829
fixed import issue for toastcontainer tests
blackbaud-conorwright Apr 18, 2018
99696ac
cleaned up based on style guide from steve in infinite scroll pr
blackbaud-conorwright Apr 19, 2018
874ef58
Switched to using sky-shadow on hover of toasts
blackbaud-conorwright Apr 19, 2018
636c5dd
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 23, 2018
0158250
Merge remote-tracking branch 'origin/master' into toastr-fromscratch
blackbaud-conorwright Apr 23, 2018
f57ffc0
fixed styling issues that came from inf scroll PR
blackbaud-conorwright Apr 24, 2018
e548824
added unit testing for the toast adapter
blackbaud-conorwright Apr 25, 2018
c6c847b
added aria-live and role attrs to toasts
blackbaud-conorwright Apr 30, 2018
bdc97a6
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 1, 2018
ff5093c
Merge remote-tracking branch 'origin/master' into toastr-fromscratch
blackbaud-conorwright May 1, 2018
83e7d04
Merge branch 'master' into toastr-fromscratch
Blackbaud-SteveBrush May 1, 2018
6104aaf
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 2, 2018
01c38d6
refactored toast design to address PR comments
blackbaud-conorwright May 3, 2018
2fa1e41
prettied up the demo a little
blackbaud-conorwright May 4, 2018
57bfe9c
updated for the remaining PR comments
blackbaud-conorwright May 4, 2018
6e766de
Merge branch 'master' into toastr-fromscratch
Blackbaud-SteveBrush May 7, 2018
d576545
refactored for PR comments
blackbaud-conorwright May 8, 2018
15103e0
Merge branch 'toastr-fromscratch' of github.com:blackbaud-conorwright…
blackbaud-conorwright May 8, 2018
37f50ec
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 8, 2018
ac1e7bd
Merge remote-tracking branch 'origin/master' into toastr-fromscratch
blackbaud-conorwright May 8, 2018
c707c3f
Adjustments
Blackbaud-SteveBrush May 9, 2018
a4c78e8
Unit tests
Blackbaud-SteveBrush May 10, 2018
c6d9b96
General cleanup
Blackbaud-SteveBrush May 10, 2018
62458b7
Updated visual tests
Blackbaud-SteveBrush May 10, 2018
393c00c
Added jsdoc
Blackbaud-SteveBrush May 10, 2018
ab1053a
Final adjustments
Blackbaud-SteveBrush May 10, 2018
0ffa106
Merge branch 'master' into contrib-toastr-fromscratch
Blackbaud-SteveBrush May 11, 2018
ed98ba9
Removed unused toastr dependency
Blackbaud-SteveBrush May 11, 2018
25423a2
Running compact logger for visual tests
Blackbaud-SteveBrush May 14, 2018
6a8b924
Merge branch 'master' into contrib-toastr-fromscratch
Blackbaud-SteveBrush May 18, 2018
c78585b
Converted to enum type
Blackbaud-SteveBrush May 18, 2018
bc23548
Created backwards compatible string enum
Blackbaud-SteveBrush May 18, 2018
1e20c13
Added animation and scrollbar
Blackbaud-SteveBrush May 18, 2018
a2fb02d
Fixed unit test for animation
Blackbaud-SteveBrush May 18, 2018
d0fb337
Added scrollBottom method to adapter
Blackbaud-SteveBrush May 18, 2018
e2aeb30
Adjusted animation imports
Blackbaud-SteveBrush May 19, 2018
b0e50e3
Converted to num enum
Blackbaud-SteveBrush May 21, 2018
c47b5b2
Close all toasts with animation
Blackbaud-SteveBrush May 21, 2018
8357564
Running ngOnDestroy
Blackbaud-SteveBrush May 21, 2018
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"microedge-rxstate": "2.0.2",
"moment": "2.21.0",
"ng2-dragula": "1.5.0",
"ng2-toastr": "4.1.2",
"web-animations-js": "2.3.1"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion skyux-spa-visual-tests/config/utils/start-visual.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ function spawnServer() {
function spawnBuild(skyPagesConfig, webpack) {
return new Promise(resolve => {
logger.info('Running build');
build([], skyPagesConfig, webpack).then(stats => {
build(
{ logFormat: 'compact' },
skyPagesConfig,
webpack
).then(stats => {
logger.info('Completed build');
resolve(stats.toJson().chunks);
});
Expand Down
2 changes: 2 additions & 0 deletions skyux-spa-visual-tests/src/app/app-extras.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';

import { FlyoutDemoComponent } from './flyout/flyout-demo.component';
import { ToastDemoComponent } from './toast/toast-demo.component';

import { ModalDemoComponent } from './modal/modal-demo.component';
import { ModalLargeDemoComponent } from './modal/modal-large-demo.component';
Expand All @@ -16,6 +17,7 @@ import { Tile2Component } from './tiles/tile2.component';
providers: [],
entryComponents: [
FlyoutDemoComponent,
ToastDemoComponent,
ModalDemoComponent,
ModalLargeDemoComponent,
ModalFullPageDemoComponent,
Expand Down
2 changes: 2 additions & 0 deletions skyux-spa-visual-tests/src/app/toast/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<toast-visual>
</toast-visual>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<strong
class="sky-custom-toast"
>
Toast component
</strong>
19 changes: 19 additions & 0 deletions skyux-spa-visual-tests/src/app/toast/toast-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
ChangeDetectionStrategy,
Component
} from '@angular/core';

import {
SkyToastInstance
} from '@blackbaud/skyux/dist/core';

@Component({
selector: 'sky-test-cmp-toast',
templateUrl: './toast-demo.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ToastDemoComponent {
constructor(
public message: SkyToastInstance
) { }
}
18 changes: 18 additions & 0 deletions skyux-spa-visual-tests/src/app/toast/toast-visual.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div
id="screenshot-toast"
>
<button
class="sky-btn sky-btn-primary"
type="button"
(click)="openToast()"
>
Open toast
</button>
<button
class="sky-btn sky-btn-secondary"
type="button"
(click)="openComponent()"
>
Open custom toast
</button>
</div>
31 changes: 31 additions & 0 deletions skyux-spa-visual-tests/src/app/toast/toast-visual.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
Component,
ChangeDetectionStrategy
} from '@angular/core';

import {
SkyToastService
} from '@blackbaud/skyux/dist/core';

import {
ToastDemoComponent
} from './toast-demo.component';

@Component({
selector: 'toast-visual',
templateUrl: './toast-visual.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ToastVisualComponent {
constructor(
private toastService: SkyToastService
) { }

public openToast() {
this.toastService.openMessage('Toast message');
}

public openComponent() {
this.toastService.openComponent(ToastDemoComponent, {});
}
}
58 changes: 58 additions & 0 deletions skyux-spa-visual-tests/src/app/toast/toast.visual-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
SkyVisualTest
} from '../../../config/utils/visual-test-commands';

import {
by,
element
} from 'protractor';

describe('Toast', () => {
it('should match previous toast screenshot', () => {
return SkyVisualTest.setupTest('toast')
.then(() => {
element(by.css('.sky-btn-primary')).click();
SkyVisualTest.moveCursorOffScreen();
return SkyVisualTest.compareScreenshot({
screenshotName: 'toast',
selector: '.sky-toaster'
});
});
});

it('should match previous templated toast screenshot', () => {
return SkyVisualTest.setupTest('toast')
.then(() => {
element(by.css('.sky-btn-secondary')).click();
SkyVisualTest.moveCursorOffScreen();
return SkyVisualTest.compareScreenshot({
screenshotName: 'toast-component',
selector: '.sky-toaster'
});
});
});

it('should match previous toast screenshot on tiny screens', () => {
return SkyVisualTest.setupTest('toast', 480)
.then(() => {
element(by.css('.sky-btn-primary')).click();
SkyVisualTest.moveCursorOffScreen();
return SkyVisualTest.compareScreenshot({
screenshotName: 'toast-xs',
selector: '.sky-toaster'
});
});
});

it('should match previous templated toast screenshot on tiny screens', () => {
return SkyVisualTest.setupTest('toast', 480)
.then(() => {
element(by.css('.sky-btn-secondary')).click();
SkyVisualTest.moveCursorOffScreen();
return SkyVisualTest.compareScreenshot({
screenshotName: 'toast-component-xs',
selector: '.sky-toaster'
});
});
});
});
3 changes: 3 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { SkyTabsModule } from './modules/tabs';
import { SkyTextExpandModule } from './modules/text-expand';
import { SkyTextExpandRepeaterModule } from './modules/text-expand-repeater';
import { SkyTextHighlightModule } from './modules/text-highlight';
import { SkyToastModule } from './modules/toast';
import { SkyTokensModule } from './modules/tokens';
import { SkyToolbarModule } from './modules/toolbar';
import { SkyTilesModule } from './modules/tiles';
Expand Down Expand Up @@ -125,6 +126,7 @@ import { SkyWaitModule } from './modules/wait';
SkyTextHighlightModule,
SkyTilesModule,
SkyTimepickerModule,
SkyToastModule,
SkyTokensModule,
SkyToolbarModule,
SkyUrlValidationModule,
Expand Down Expand Up @@ -190,6 +192,7 @@ export * from './modules/text-expand-repeater';
export * from './modules/text-highlight';
export * from './modules/tiles';
export * from './modules/timepicker';
export * from './modules/toast';
export * from './modules/tokens';
export * from './modules/toolbar';
export * from './modules/url-validation';
Expand Down
4 changes: 4 additions & 0 deletions src/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ import {
SkyTextHighlightDemoComponent,
SkyTileDemoComponent,
SkyTimepickerDemoComponent,
SkyToastDemoComponent,
SkyToastCustomDemoComponent,
SkyTokensDemoComponent,
SkyToolbarDemoComponent,
SkyUrlValidationDemoComponent,
Expand Down Expand Up @@ -148,6 +150,8 @@ const components = [
SkyTextHighlightDemoComponent,
SkyTileDemoComponent,
SkyTimepickerDemoComponent,
SkyToastDemoComponent,
SkyToastCustomDemoComponent,
SkyTokensDemoComponent,
SkyToolbarDemoComponent,
SkyUrlValidationDemoComponent,
Expand Down
37 changes: 36 additions & 1 deletion src/demos/demo.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Injectable } from '@angular/core';
// #region imports
import {
Injectable
} from '@angular/core';

import {
SkyActionButtonDemoComponent,
Expand Down Expand Up @@ -52,13 +55,15 @@ import {
SkyTextHighlightDemoComponent,
SkyTileDemoComponent,
SkyTimepickerDemoComponent,
SkyToastDemoComponent,
SkyTokensDemoComponent,
SkyToolbarDemoComponent,
SkyUrlValidationDemoComponent,
SkyVerticalTabsDemoComponent,
SkyWaitDemoComponent,
SkyWizardDemoComponent
} from './index';
// #endregion

/**
* This service provides consumers with the raw file contents for each component demo.
Expand Down Expand Up @@ -1025,6 +1030,36 @@ export class SkyDemoService {
}
]
},
{
name: 'Toast',
component: SkyToastDemoComponent,
files: [
{
name: 'toast-demo.component.html',
fileContents: require('!!raw-loader!./toast/toast-demo.component.html')
},
{
name: 'toast-demo.component.ts',
fileContents: require('!!raw-loader!./toast/toast-demo.component.ts'),
componentName: 'SkyToastDemoComponent',
bootstrapSelector: 'sky-toast-demo'
},
{
name: 'toast-custom-demo.component.html',
fileContents: require('!!raw-loader!./toast/toast-custom-demo.component.html')
},
{
name: 'toast-custom-demo.component.ts',
fileContents: require('!!raw-loader!./toast/toast-custom-demo.component.ts'),
componentName: 'SkyToastCustomDemoComponent',
bootstrapSelector: 'sky-toast-custom-demo'
},
{
name: 'toast-custom-demo-context.ts',
fileContents: require('!!raw-loader!./toast/toast-custom-demo-context.ts')
}
]
},
{
name: 'Tokens',
component: SkyTokensDemoComponent,
Expand Down
1 change: 1 addition & 0 deletions src/demos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export * from './text-expand';
export * from './text-highlight';
export * from './tile';
export * from './timepicker';
export * from './toast';
export * from './tokens';
export * from './toolbar';
export * from './url-validation';
Expand Down
2 changes: 2 additions & 0 deletions src/demos/toast/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './toast-custom-demo.component';
export * from './toast-demo.component';
5 changes: 5 additions & 0 deletions src/demos/toast/toast-custom-demo-context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class SkyToastCustomDemoContext {
constructor(
public message: string
) { }
}
13 changes: 13 additions & 0 deletions src/demos/toast/toast-custom-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<p>
{{ context.message }}
</p>
<p>
Some link: <a href="http://example.com">example.com</a>
</p>
<button
class="sky-btn sky-btn-default"
type="button"
(click)="close()"
>
Close
</button>
28 changes: 28 additions & 0 deletions src/demos/toast/toast-custom-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
ChangeDetectionStrategy,
Component
} from '@angular/core';

import {
SkyToastInstance
} from '../../core';

import {
SkyToastCustomDemoContext
} from './toast-custom-demo-context';

@Component({
selector: 'sky-toast-custom-demo',
templateUrl: './toast-custom-demo.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SkyToastCustomDemoComponent {
constructor(
public context: SkyToastCustomDemoContext,
private instance: SkyToastInstance
) { }

public close(): void {
this.instance.close();
}
}
44 changes: 44 additions & 0 deletions src/demos/toast/toast-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="sky-toast-demo">
<fieldset>
<label class="sky-control-label">
Select toast type:
</label>
<ul class="sky-list-unstyled">
<li *ngFor="let type of types">
<sky-radio
name="radiogroup"
[value]="type"
[(ngModel)]="selectedType"
>
<sky-radio-label>
{{ type }}
</sky-radio-label>
</sky-radio>
</li>
</ul>
</fieldset>

<button
class="sky-btn sky-btn-primary"
type="button"
(click)="openMessage()"
>
Open toast
</button>

<button
class="sky-btn sky-btn-primary"
type="button"
(click)="openComponent()"
>
Open toast with custom component
</button>

<button
class="sky-btn sky-btn-default"
type="button"
(click)="closeAll()"
>
Close all
</button>
</div>
Loading