mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs(docs-infra): tooltip on hover and message after copied (#63167)
PR Close #63167
This commit is contained in:
committed by
Miles Malerba
parent
0d57dfbcf0
commit
d635e6c07e
@@ -18,6 +18,8 @@
|
||||
class="docs-example-copy-link"
|
||||
[attr.aria-label]="'Copy link to ' + exampleMetadata()?.title + ' example to the clipboard'"
|
||||
(click)="copyLink()"
|
||||
matTooltip="Copy link to example"
|
||||
matTooltipPosition="above"
|
||||
>
|
||||
<i aria-hidden="true">
|
||||
<svg
|
||||
@@ -41,8 +43,9 @@
|
||||
<button
|
||||
type="button"
|
||||
(click)="toggleExampleVisibility()"
|
||||
[attr.title]="(expanded() ? 'Collapse' : 'Expand') + ' example'"
|
||||
[attr.aria-label]="(expanded() ? 'Collapse' : 'Expand') + ' code example'"
|
||||
matTooltip="{{ expanded() ? 'Collapse' : 'Expand' }} example"
|
||||
matTooltipPosition="above"
|
||||
>
|
||||
<i aria-hidden="true">
|
||||
@if (!expanded()) {
|
||||
@@ -100,9 +103,10 @@
|
||||
<a
|
||||
[href]="githubUrl()"
|
||||
target="_blank"
|
||||
title="Open example on GitHub"
|
||||
class="docs-example-github-link"
|
||||
aria-label="Open example on GitHub"
|
||||
matTooltip="Open example on GitHub"
|
||||
matTooltipPosition="above"
|
||||
>
|
||||
<i aria-hidden="true">
|
||||
<svg
|
||||
@@ -128,8 +132,9 @@
|
||||
[href]="stackblitzUrl()"
|
||||
target="_blank"
|
||||
class="docs-example-stackblitz-link"
|
||||
title="Edit this example in StackBlitz"
|
||||
aria-label="Edit this example in StackBlitz"
|
||||
aria-label="Edit example in StackBlitz"
|
||||
matTooltip="Edit example in StackBlitz"
|
||||
matTooltipPosition="above"
|
||||
>
|
||||
<i aria-hidden="true">
|
||||
<svg
|
||||
|
||||
@@ -215,7 +215,7 @@ describe('ExampleViewer', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
const stackblitzButton = fixture.debugElement.query(
|
||||
By.css('a[aria-label="Edit this example in StackBlitz"]'),
|
||||
By.css('a[aria-label="Edit example in StackBlitz"]'),
|
||||
);
|
||||
expect(stackblitzButton).toBeTruthy();
|
||||
expect(stackblitzButton.nativeElement.href).toBe(component.stackblitzUrl());
|
||||
|
||||
@@ -28,6 +28,7 @@ import {CopySourceCodeButton} from '../../copy-source-code-button/copy-source-co
|
||||
import {ExampleMetadata, Snippet} from '../../../interfaces/index';
|
||||
import {EXAMPLE_VIEWER_CONTENT_LOADER} from '../../../providers/index';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {MatTooltipModule} from '@angular/material/tooltip';
|
||||
|
||||
export enum CodeExampleViewMode {
|
||||
SNIPPET = 'snippet',
|
||||
@@ -41,7 +42,7 @@ export const HIDDEN_CLASS_NAME = 'hidden';
|
||||
|
||||
@Component({
|
||||
selector: 'docs-example-viewer',
|
||||
imports: [CommonModule, CopySourceCodeButton, MatTabsModule],
|
||||
imports: [CommonModule, CopySourceCodeButton, MatTabsModule, MatTooltipModule],
|
||||
templateUrl: './example-viewer.component.html',
|
||||
styleUrls: ['./example-viewer.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
Reference in New Issue
Block a user