Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit a374120

Browse files
devversionjelbourn
authored andcommitted
fixup! refactor: update stackblitz examples write to use webcontainers for v13 compatibility
Address Jeremys's feedback
1 parent 1a30d7b commit a374120

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/app/shared/stack-blitz/stack-blitz-button.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {MatButtonModule} from '@angular/material/button';
44
import {MatIconModule} from '@angular/material/icon';
55
import {MatTooltipModule} from '@angular/material/tooltip';
66
import {StackBlitzWriter} from './stack-blitz-writer';
7+
import {MatSnackBar, MatSnackBarModule} from '@angular/material/snack-bar';
78

89
@Component({
910
selector: 'stack-blitz-button',
@@ -33,13 +34,17 @@ export class StackBlitzButton {
3334
}
3435
}
3536

36-
constructor(private stackBlitzWriter: StackBlitzWriter, private ngZone: NgZone) {}
37+
constructor(
38+
private stackBlitzWriter: StackBlitzWriter,
39+
private ngZone: NgZone,
40+
private snackBar: MatSnackBar) {}
3741

3842
openStackBlitz(): void {
39-
if (this._openStackBlitzFn === null) {
40-
alert('StackBlitz is not ready yet. Please try again in a few seconds.');
41-
} else {
43+
if (this._openStackBlitzFn) {
4244
this._openStackBlitzFn();
45+
} else {
46+
this.snackBar.open('StackBlitz is not ready yet. Please try again in a few seconds.',
47+
undefined, {duration: 5000});
4348
}
4449
}
4550

@@ -53,7 +58,7 @@ export class StackBlitzButton {
5358
}
5459

5560
@NgModule({
56-
imports: [MatTooltipModule, MatButtonModule, MatIconModule],
61+
imports: [MatTooltipModule, MatButtonModule, MatIconModule, MatSnackBarModule],
5762
exports: [StackBlitzButton],
5863
declarations: [StackBlitzButton],
5964
providers: [StackBlitzWriter],

0 commit comments

Comments
 (0)