-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): add examples content, make it runnable
- Loading branch information
1 parent
40977e0
commit abe3493
Showing
10 changed files
with
147 additions
and
53 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
92 changes: 66 additions & 26 deletions
92
projects/elements-demo/src/app/features/examples/basic/basic.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 |
---|---|---|
@@ -1,30 +1,70 @@ | ||
<h1>Basic</h1> | ||
<div class="wrapper"> | ||
<h1>Basic</h1> | ||
|
||
<div class="content"> | ||
<div class="implementation"> | ||
<ng-template #error>Loading failed...</ng-template> | ||
<ng-template #loading>Loading...</ng-template> | ||
<mwc-button | ||
*axLazyElement=" | ||
'https://unpkg.com/@material/mwc-button@0.6.0/mwc-button.js?module'; | ||
loadingTemplate: loading; | ||
errorTemplate: error; | ||
module: true | ||
" | ||
raised | ||
(click)="increment()" | ||
> | ||
Increment | ||
</mwc-button> | ||
|
||
Counter: {{ counter }} | ||
<h2>Plain directive</h2> | ||
<div class="content"> | ||
<div class="implementation" *ngIf="!example1"> | ||
<button mat-flat-button color="accent" (click)="example1 = true"> | ||
<mat-icon>play_arrow</mat-icon> | ||
Run | ||
</button> | ||
</div> | ||
<div class="implementation" *ngIf="example1"> | ||
<mwc-icon | ||
*axLazyElement=" | ||
'https://unpkg.com/@material/mwc-icon@0.6.0/mwc-icon.js?module'; | ||
module: true | ||
" | ||
> | ||
favorite | ||
</mwc-icon> | ||
</div> | ||
<div class="description"> | ||
<p> | ||
The most simple example, all we need is to use element tag, for example | ||
<code><mwc-icon></code> and add | ||
<code>*axLazyElement</code> directive with the url pointing to the | ||
element implementation. | ||
</p> | ||
<pre [highlight]="codeExample1"></pre> | ||
</div> | ||
</div> | ||
<div class="description"> | ||
<p> | ||
The most simple example, all we need is to use element tag, for example | ||
<code><mwc-button></code> and add | ||
<code>*axLazyElement</code> directive with the url pointing to the element | ||
implementation. | ||
</p> | ||
|
||
<h2>Use loading <code><ng-template></code></h2> | ||
<div class="content"> | ||
<div class="implementation" *ngIf="!example2"> | ||
<button mat-flat-button color="accent" (click)="example2 = true"> | ||
<mat-icon>play_arrow</mat-icon> | ||
Run | ||
</button> | ||
</div> | ||
<div class="implementation" *ngIf="example2"> | ||
<ng-template #error>Loading failed...</ng-template> | ||
<ng-template #loading>Loading...</ng-template> | ||
<mwc-button | ||
*axLazyElement=" | ||
'https://unpkg.com/@material/mwc-button@0.6.0/mwc-button.js?module'; | ||
loadingTemplate: loading; | ||
errorTemplate: error; | ||
module: true | ||
" | ||
raised | ||
(click)="increment()" | ||
> | ||
Increment | ||
</mwc-button> | ||
<p>Counter: {{ counter }}</p> | ||
</div> | ||
<div class="description"> | ||
<p> | ||
In this example we're loading | ||
<code><mwc-button></code> using the | ||
<code>*axLazyElement</code> directive but we're also adding | ||
<code><ng-template #loading>Loading...<ng-template></code> which | ||
will display before the element was loaded (depending on your connection | ||
speed) | ||
</p> | ||
<pre [highlight]="codeExample2"></pre> | ||
</div> | ||
</div> | ||
</div> |
22 changes: 20 additions & 2 deletions
22
projects/elements-demo/src/app/features/examples/basic/basic.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 |
---|---|---|
@@ -1,17 +1,35 @@ | ||
:host { | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
.content { | ||
display: flex; | ||
flex-wrap: wrap; | ||
flex-direction: column; | ||
margin: 0 0 50px 0; | ||
|
||
.implementation { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
flex: 1; | ||
margin: 0 20px 20px 0; | ||
border: 2px solid #eee; | ||
padding: 20px; | ||
|
||
p { | ||
margin: 10px 0 0 0; | ||
} | ||
} | ||
|
||
.description { | ||
flex: 1.5; | ||
} | ||
} | ||
} | ||
|
||
:host-context(.responsive-large) { | ||
.wrapper { | ||
width: 60%; | ||
} | ||
} |
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
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