dees-catalog/ts_web/elements/dees-windowlayer.ts

56 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-02-13 21:52:36 +00:00
import { customElement, LitElement, TemplateResult, html, property } from 'lit-element';
import * as domtools from '@designestate/dees-domtools';
declare global {
interface HTMLElementTagNameMap {
'dees-windowlayer': DeesWindowLayer;
}
}
@customElement('dees-windowlayer')
export class DeesWindowLayer extends LitElement {
public static demo = () => html`<dees-windowlayer></dees-windowlayer>`;
constructor() {
super();
domtools.elementBasic.setup();
}
public render(): TemplateResult {
return html`
${domtools.elementBasic.styles}
<style>
.windowOverlay {
2021-08-29 15:10:25 +00:00
will-change: transform;
2021-02-13 21:52:36 +00:00
transition: all 1s;
position: fixed;
top: 0px;
left: 0px;
height: 100vh;
width: 100vw;
2021-08-29 15:10:25 +00:00
display: flex;
justify-content: center;
align-items: center;
2021-02-13 21:52:36 +00:00
background: rgba(0, 0, 0, 0.0);
backdrop-filter: blur(0px);
}
2021-08-29 15:10:25 +00:00
2021-02-13 21:52:36 +00:00
.visible {
background: rgba(0, 0, 0, 0.2);
2021-08-29 15:10:25 +00:00
backdrop-filter: brightness(0.3);
2021-02-13 21:52:36 +00:00
}
</style>
<div class="windowOverlay">
<slot></slot>
</div>
`;
}
firstUpdated() {
setTimeout(() => {
this.shadowRoot.querySelector('.windowOverlay').classList.add('visible');
}, 100);
}
}