Background for closing the sidebar
This commit is contained in:
@@ -55,6 +55,20 @@ export class SiteSidebar extends LitElement {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: calc(100% + 2px);
|
left: calc(100% + 2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg {
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
transition-behavior: allow-discrete;
|
||||||
|
background: black;
|
||||||
|
opacity: 0.6;
|
||||||
|
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
|
||||||
|
@starting-style {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
static properties = {
|
static properties = {
|
||||||
@@ -71,14 +85,23 @@ export class SiteSidebar extends LitElement {
|
|||||||
open: this.open
|
open: this.open
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`<aside class="${classMap(classes)}">
|
return html`
|
||||||
|
<aside class="${classMap(classes)}">
|
||||||
<button class="toggle-button" @click="${this._toggleOpen}">
|
<button class="toggle-button" @click="${this._toggleOpen}">
|
||||||
<img src="${this.open ? closeIcon : openIcon}">
|
<img src="${this.open ? closeIcon : openIcon}">
|
||||||
</button>
|
</button>
|
||||||
<div class="padding">
|
<div class="padding">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</aside>`
|
</aside>
|
||||||
|
${this._bg()}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
_bg() {
|
||||||
|
if(!this.open) return null
|
||||||
|
|
||||||
|
return html`<div class="bg" @click="${this._toggleOpen}"></div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
_toggleOpen() {
|
_toggleOpen() {
|
||||||
|
|||||||
Reference in New Issue
Block a user