src/app/modules/content/video-modal/video-modal-launcher/video-modal-launcher.component.ts
Component for launching an angular material modal.
changeDetection | ChangeDetectionStrategy.OnPush |
selector | ccf-video-modal-launcher |
styleUrls | ./video-modal-launcher.component.scss |
templateUrl | ./video-modal-launcher.component.html |
Properties |
|
Methods |
Inputs |
HostBindings |
constructor(dialog: MatDialog)
|
||||||
Creates an instance of video modal launcher component.
Parameters :
|
visible | |
Type : boolean
|
|
Default value : true
|
|
Input used to toggle the launcher on and off. |
class |
Type : "ccf-video-modal-launcher"
|
Default value : 'ccf-video-modal-launcher'
|
HTML class name |
launchVideoModal |
launchVideoModal()
|
Launches the video modal component.
Returns :
void
|
Readonly clsName |
Type : string
|
Default value : 'ccf-video-modal-launcher'
|
Decorators :
@HostBinding('class')
|
HTML class name |
import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { VideoModalComponent } from '../video-modal/video-modal.component';
/**
* Component for launching an angular material modal.
*/
@Component({
selector: 'ccf-video-modal-launcher',
templateUrl: './video-modal-launcher.component.html',
styleUrls: ['./video-modal-launcher.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class VideoModalLauncherComponent {
/** HTML class name */
@HostBinding('class') readonly clsName = 'ccf-video-modal-launcher';
/**
* Input used to toggle the launcher on and off.
*/
@Input() visible = true;
/**
* Creates an instance of video modal launcher component.
*/
constructor(private readonly dialog: MatDialog) {}
/**
* Launches the video modal component.
*/
launchVideoModal(): void {
this.dialog.open(VideoModalComponent, {
width: '46rem',
data: {},
});
}
}
<div class="description align-center video-description" *ngIf="visible">
<div class="title">WATCH</div>
"How to use the HuBMAP Registration User Interface"
</div>
<mat-icon class="play-icon-button" (click)="launchVideoModal()" *ngIf="visible"> play_circle_outline </mat-icon>
./video-modal-launcher.component.scss
:host {
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 1;
.video-description {
margin-bottom: 1.5rem;
text-align: center;
width: 30rem;
.title {
margin-bottom: 1rem;
}
}
.play-icon-button {
cursor: pointer;
font-size: 5rem;
width: 5rem;
}
}