|
1 | 1 | <div class="docs-example-viewer-wrapper">
|
2 |
| - <div class="docs-example-viewer-title"> |
| 2 | + <div class="docs-example-viewer-title" *ngIf="view !== 'compact'"> |
3 | 3 | <div class="docs-example-viewer-title-spacer">{{exampleData?.title}}</div>
|
4 | 4 |
|
5 |
| - <button mat-icon-button type="button" (click)="toggleSourceView()" |
6 |
| - [matTooltip]="'View ' + exampleData?.title + ' source'" aria-label="View source"> |
| 5 | + <button mat-icon-button type="button" (click)="toggleCompactView()" [matTooltip]="'View snippet only'" |
| 6 | + aria-label="View less" *ngIf="showCompactToggle"> |
7 | 7 | <mat-icon>
|
8 |
| - <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"> |
9 |
| - <path fill="none" d="M0 0h24v24H0V0z"></path> |
10 |
| - <path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path> |
11 |
| - </svg> |
| 8 | + <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" focusable="false"> |
| 9 | + <path |
| 10 | + d="M15.41,10H20v2h-8V4h2v4.59L20.59,2L22,3.41L15.41,10z M4,12v2h4.59L2,20.59L3.41,22L10,15.41V20h2v-8H4z"/> |
| 11 | + </svg> |
12 | 12 | </mat-icon>
|
13 | 13 | </button>
|
14 | 14 |
|
| 15 | + <button mat-icon-button type="button" (click)="toggleSourceView()" |
| 16 | + [matTooltip]="view==='collapsed' ? 'View code' : 'Hide code'" aria-label="View source"> |
| 17 | + <mat-icon>code</mat-icon> |
| 18 | + </button> |
| 19 | + |
15 | 20 | <stack-blitz-button [example]="example"></stack-blitz-button>
|
16 | 21 | </div>
|
17 | 22 |
|
18 |
| - <div class="docs-example-viewer-source" *ngIf="showSource"> |
19 |
| - <mat-tab-group> |
| 23 | + <div class="docs-example-viewer-source" *ngIf="view === 'full'"> |
| 24 | + <mat-tab-group animationDuration="0ms"> |
20 | 25 | <mat-tab *ngFor="let tabName of _getExampleTabNames()" [label]="tabName">
|
21 |
| - <div class="docs-example-source-wrapper"> |
22 |
| - <button mat-icon-button type="button" class="docs-example-source-copy" |
23 |
| - title="Copy example source" aria-label="Copy example source to clipboard" |
24 |
| - (click)="copySource(viewer.textContent)"> |
| 26 | + <div class="button-bar"> |
| 27 | + <button mat-icon-button type="button" (click)="copySource(snippet.first.viewer.textContent)" |
| 28 | + class="docs-example-source-copy docs-example-button" [matTooltip]="'Copy example source'" |
| 29 | + title="Copy example source" aria-label="Copy example source to clipboard"> |
25 | 30 | <mat-icon>content_copy</mat-icon>
|
26 | 31 | </button>
|
27 |
| - <pre class="docs-example-source"><doc-viewer |
28 |
| - #viewer [documentUrl]="exampleTabs[tabName]"></doc-viewer></pre> |
29 | 32 | </div>
|
| 33 | + <code-snippet [source]="exampleTabs[tabName]"></code-snippet> |
30 | 34 | </mat-tab>
|
31 | 35 | </mat-tab-group>
|
32 | 36 | </div>
|
33 | 37 |
|
34 |
| - <div class="docs-example-viewer-body"> |
| 38 | + <div class="docs-example-viewer-source-compact" *ngIf="view === 'compact'"> |
| 39 | + <div class="button-bar"> |
| 40 | + <button mat-icon-button type="button" (click)="copySource(snippet.first.viewer.textContent)" |
| 41 | + class="docs-example-source-copy docs-example-button" [matTooltip]="'Copy snippet'" |
| 42 | + title="Copy example source" aria-label="Copy example source to clipboard"> |
| 43 | + <mat-icon>content_copy</mat-icon> |
| 44 | + </button> |
| 45 | + <button mat-icon-button type="button" (click)="toggleCompactView()" |
| 46 | + class="docs-example-compact-toggle docs-example-button" [matTooltip]="'View full example'" |
| 47 | + aria-label="View less"> |
| 48 | + <mat-icon> |
| 49 | + <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" focusable="false"> |
| 50 | + <polygon points="13,3 13,5 17.59,5 5,17.59 5,13 3,13 3,21 11,21 11,19 6.41,19 19,6.41 19,11 21,11 21,3"/> |
| 51 | + </svg> |
| 52 | + </mat-icon> |
| 53 | + </button> |
| 54 | + </div> |
| 55 | + <code-snippet [source]="file" [lines]="lines" *ngIf="file !== 'demo'"></code-snippet> |
| 56 | + </div> |
| 57 | + |
| 58 | + <div class="docs-example-viewer-body" *ngIf="view !== 'compact' || file === 'demo'"> |
35 | 59 | <ng-template *ngIf="_exampleComponentType && _exampleModuleFactory"
|
36 | 60 | [ngComponentOutlet]="_exampleComponentType"
|
37 | 61 | [ngComponentOutletNgModuleFactory]="_exampleModuleFactory"></ng-template>
|
|
0 commit comments