Compare commits
2 Commits
35d054e0b8
...
main
Author | SHA1 | Date | |
---|---|---|---|
a0890e72d4 | |||
eb8b277918 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tp/tp-responsive-menu",
|
"name": "@tp/tp-responsive-menu",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "tp-responsive-menu.js",
|
"main": "tp-responsive-menu.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -13,27 +13,49 @@ class TpResponsiveMenu extends LitElement {
|
|||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
z-index: 1;
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host([responsive]) {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host([responsive]) .content {
|
:host([responsive]) .content {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
z-index: 9999;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
transform: translateX(-100%);
|
transform: translateX(-100%);
|
||||||
transition: transform 400ms ease-in-out;
|
transition: transform 300ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host([responsive][visible]) .content {
|
:host([responsive][visible]) .content {
|
||||||
transform: translateX(0);
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.backdrop {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: #000000;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 300ms ease-in-out;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host([visible]) .backdrop {
|
||||||
|
opacity: 0.7;
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -42,9 +64,11 @@ class TpResponsiveMenu extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<tp-media-query query="(min-width: 0) and (max-width: ${this.responsiveWidth}px)" @media-query-update=${this._queryUpdated}></tp-media-query>
|
<tp-media-query query="(min-width: 0) and (max-width: ${this.responsiveWidth}px)" @media-query-update=${this._queryUpdated}></tp-media-query>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content" part="content">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="backdrop" @click=${this.close}></div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user