Eliminar 'components/page-menu.js'
parent
8c79d1571c
commit
00ff2196cc
@ -1,42 +0,0 @@
|
|||||||
export class PageMenu extends HTMLElement {
|
|
||||||
constructor() {
|
|
||||||
super()
|
|
||||||
this.attachShadow({mode: 'open'})
|
|
||||||
}
|
|
||||||
|
|
||||||
connectedCallback() {
|
|
||||||
const style = document.createElement('style')
|
|
||||||
style.textContent = `
|
|
||||||
:host {
|
|
||||||
background: #222;
|
|
||||||
color: #ddd;
|
|
||||||
padding: 3px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: stretch;
|
|
||||||
min-width: 180px;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
background: #222;
|
|
||||||
font-size: 120%;
|
|
||||||
border: none;
|
|
||||||
color: inherit;
|
|
||||||
padding: 4px 10px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
this.shadowRoot.append(style)
|
|
||||||
}
|
|
||||||
|
|
||||||
add(text, handler) {
|
|
||||||
const btn = document.createElement('button')
|
|
||||||
btn.innerText = text
|
|
||||||
this.shadowRoot.appendChild(btn)
|
|
||||||
btn.addEventListener('click', () => {
|
|
||||||
this.dispatchEvent(new CustomEvent(
|
|
||||||
'close-menu', {bubbles: true}
|
|
||||||
))
|
|
||||||
handler()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue