|
5 | 5 | @if (view() === 'snippet') {
|
6 | 6 | <div class="docs-example-viewer-source-compact">
|
7 | 7 | <div class="docs-button-bar">
|
8 |
| - <button mat-icon-button type="button" (click)="copySource(snippet())" |
9 |
| - class="docs-example-source-copy docs-example-button" matTooltip="Copy snippet" |
10 |
| - title="Copy example source" aria-label="Copy example source to clipboard"> |
| 8 | + <button |
| 9 | + mat-icon-button |
| 10 | + type="button" |
| 11 | + (click)="copySource(snippet())" |
| 12 | + class="docs-example-source-copy docs-example-button" |
| 13 | + matTooltip="Copy snippet" |
| 14 | + title="Copy example source" |
| 15 | + aria-label="Copy example source to clipboard" |
| 16 | + > |
11 | 17 | <mat-icon>content_copy</mat-icon>
|
12 | 18 | </button>
|
13 |
| - <button mat-icon-button type="button" (click)="toggleCompactView()" |
14 |
| - class="docs-example-compact-toggle docs-example-button" matTooltip="View full example" |
15 |
| - aria-label="View less"> |
| 19 | + <button |
| 20 | + mat-icon-button |
| 21 | + type="button" |
| 22 | + (click)="toggleCompactView()" |
| 23 | + class="docs-example-compact-toggle docs-example-button" |
| 24 | + matTooltip="View full example" |
| 25 | + aria-label="View less" |
| 26 | + > |
16 | 27 | <mat-icon>
|
17 | 28 | <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" focusable="false">
|
18 |
| - <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"/> |
| 29 | + <polygon |
| 30 | + 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" |
| 31 | + /> |
19 | 32 | </svg>
|
20 | 33 | </mat-icon>
|
21 | 34 | </button>
|
22 | 35 | </div>
|
23 | 36 |
|
24 | 37 | @if (fileUrl) {
|
25 |
| - <code-snippet [source]="fileUrl"/> |
| 38 | + <code-snippet [source]="fileUrl" /> |
26 | 39 | }
|
27 | 40 | </div>
|
28 |
| - } |
29 |
| - |
30 |
| - @else { |
| 41 | + } @else { |
31 | 42 | <div class="docs-example-viewer-title">
|
32 |
| - <div class="docs-example-viewer-title-spacer">{{exampleData?.title}}</div> |
| 43 | + <p>{{exampleData?.title}}</p> |
| 44 | + |
| 45 | + <div class="docs-example-viewer-actions"> |
| 46 | + <button |
| 47 | + mat-icon-button |
| 48 | + type="button" |
| 49 | + [attr.aria-label]="'Copy link to ' + exampleData?.title + ' example to the clipboard'" |
| 50 | + matTooltip="Copy link to example" |
| 51 | + (click)="_copyLink()" |
| 52 | + > |
| 53 | + <mat-icon>link</mat-icon> |
| 54 | + </button> |
33 | 55 |
|
34 |
| - <button |
35 |
| - mat-icon-button |
36 |
| - type="button" |
37 |
| - [attr.aria-label]="'Copy link to ' + exampleData?.title + ' example to the clipboard'" |
38 |
| - matTooltip="Copy link to example" |
39 |
| - (click)="_copyLink()"> |
40 |
| - <mat-icon>link</mat-icon> |
41 |
| - </button> |
| 56 | + @if (showCompactToggle()) { |
| 57 | + <button |
| 58 | + mat-icon-button |
| 59 | + (click)="toggleCompactView()" |
| 60 | + matTooltip="View snippet only" |
| 61 | + aria-label="View less" |
| 62 | + > |
| 63 | + <mat-icon> |
| 64 | + <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" focusable="false"> |
| 65 | + <path |
| 66 | + d="M15.41,10H20v2h-8V4h2v4.59L20.59,2L22,3.41L15.41,10z M4,12v2h4.59L2,20.59L3.41,22L10,15.41V20h2v-8H4z" |
| 67 | + /> |
| 68 | + </svg> |
| 69 | + </mat-icon> |
| 70 | + </button> |
| 71 | + } |
42 | 72 |
|
43 |
| - @if (showCompactToggle()) { |
44 |
| - <button mat-icon-button |
45 |
| - (click)="toggleCompactView()" |
46 |
| - matTooltip="View snippet only" |
47 |
| - aria-label="View less"> |
| 73 | + <button |
| 74 | + mat-icon-button |
| 75 | + type="button" |
| 76 | + (click)="toggleSourceView()" |
| 77 | + [matTooltip]="view() === 'demo' ? 'View code' : 'Hide code'" |
| 78 | + aria-label="View source" |
| 79 | + > |
48 | 80 | <mat-icon>
|
49 |
| - <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" focusable="false"> |
50 |
| - <path |
51 |
| - d="M15.41,10H20v2h-8V4h2v4.59L20.59,2L22,3.41L15.41,10z M4,12v2h4.59L2,20.59L3.41,22L10,15.41V20h2v-8H4z"/> |
52 |
| - </svg> |
| 81 | + {{view() === 'demo' ? 'code' : 'code_off'}} |
53 | 82 | </mat-icon>
|
54 | 83 | </button>
|
55 |
| - } |
56 |
| - |
57 |
| - <button mat-icon-button type="button" (click)="toggleSourceView()" |
58 |
| - [matTooltip]="view() === 'demo' ? 'View code' : 'Hide code'" aria-label="View source"> |
59 |
| - <mat-icon>code</mat-icon> |
60 |
| - </button> |
61 | 84 |
|
62 |
| - <stackblitz-button [example]="example" /> |
| 85 | + <stackblitz-button [example]="example" /> |
| 86 | + </div> |
63 | 87 | </div>
|
64 | 88 |
|
65 | 89 | @if (view() === 'full') {
|
66 | 90 | <div class="docs-example-viewer-source">
|
67 |
| - <mat-tab-group animationDuration="0ms" [(selectedIndex)]="selectedTab" mat-stretch-tabs="false"> |
| 91 | + <mat-tab-group |
| 92 | + animationDuration="0ms" |
| 93 | + [(selectedIndex)]="selectedTab" |
| 94 | + mat-stretch-tabs="false" |
| 95 | + > |
68 | 96 | @for (tabName of _exampleTabNames(); track tabName) {
|
69 | 97 | <mat-tab [label]="tabName">
|
70 | 98 | <div class="docs-button-bar">
|
71 |
| - <button mat-icon-button type="button" (click)="copySource(snippet(), selectedTab())" |
72 |
| - class="docs-example-source-copy docs-example-button" matTooltip="Copy example source" |
73 |
| - title="Copy example source" aria-label="Copy example source to clipboard"> |
| 99 | + <button |
| 100 | + mat-icon-button |
| 101 | + type="button" |
| 102 | + (click)="copySource(snippet(), selectedTab())" |
| 103 | + class="docs-example-source-copy docs-example-button" |
| 104 | + matTooltip="Copy example source" |
| 105 | + title="Copy example source" |
| 106 | + aria-label="Copy example source to clipboard" |
| 107 | + > |
74 | 108 | <mat-icon>content_copy</mat-icon>
|
75 | 109 | </button>
|
76 | 110 | </div>
|
|
87 | 121 | @let componentType = _exampleComponentType();
|
88 | 122 |
|
89 | 123 | @if (componentType && !example?.includes('harness')) {
|
90 |
| - <ng-template [ngComponentOutlet]="componentType"/> |
| 124 | + <ng-template [ngComponentOutlet]="componentType" /> |
91 | 125 | } @else {
|
92 | 126 | <div>This example contains tests. Open in Stackblitz to run the tests.</div>
|
93 | 127 | }
|
|
0 commit comments