Created
March 20, 2021 19:14
-
-
Save riapacheco/546f6132b92b03eb58d7028795df1abe to your computer and use it in GitHub Desktop.
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
<a class="overlay-bg" (click)="overlayClicked($event)" [@overlayAnimation]="showsOverlay ? 'shows' : 'hides' "> | |
<ng-content select="[overlay-bg]"></ng-content> | |
</a> |
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
.overlay-bg { | |
display: block; | |
background-color: #00000095; | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
cursor: default; | |
overflow: hidden; | |
backdrop-filter: blur(4px); | |
} |
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
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | |
import { animate, state, style, transition, trigger } from '@angular/animations'; | |
@Component({ | |
selector: 'app-overlay-bg', | |
templateUrl: './overlay-bg.component.html', | |
styleUrls: ['./overlay-bg.component.scss'], | |
animations: [ | |
trigger('overlayAnimation', [ | |
state('shows', style({ display: 'block' })), | |
state('hides', style({ display: 'none' })), | |
transition('shows <=> hides', [ | |
animate('300ms ease-in-out') | |
]) | |
]) | |
] | |
}) | |
export class OverlayBgComponent implements OnInit { | |
@Input() showsOverlay: boolean; | |
@Output() overlayClick = new EventEmitter(); | |
constructor() { } | |
ngOnInit(): void { | |
} | |
overlayClicked(event): any { | |
this.overlayClick.emit(true); | |
} | |
} |
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
/* --------------------------------- Z-INDEX -------------------------------- */ | |
app-root, | |
router-outlet { | |
z-index: 1 !important; | |
} | |
.mobile-menu { | |
z-index: 4 !important; | |
} | |
app-navbar, .nav, .nav-lg, | |
app-mobile-nav { | |
z-index: 5; | |
} | |
app-overlay-bg, .overlay-bg { // Overlay added to global z-index to stay on top of nav elements (to ensure no scroll) | |
z-index: 6 !important; | |
} | |
app-toast, .toast { | |
z-index: 7 !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment