fix adding / removing content

pull/3094/head
yann300 6 years ago
parent 13e7544ee0
commit e80e58927b
  1. 6
      src/app/components/swap-panel-component.js
  2. 8
      src/app/components/vertical-icons-component.js

@ -27,13 +27,13 @@ class SwapPanelComponent {
}
add (moduleName, content) {
this.contents[moduleName] = yo`<div id='${moduleName}Content' class=${css.plugItIn} >${content}</div>`
this.contents[moduleName] = yo`<div class=${css.plugItIn} >${content}</div>`
this.view.appendChild(this.contents[moduleName])
}
remove (moduleName) {
var el = this.view.querySelector(`div#${moduleName}Content`)
el.parentElement.removeChild(el)
let el = this.contents[moduleName]
if (el) el.parentElement.removeChild(el)
}
render () {

@ -12,16 +12,18 @@ class VerticalIconComponent {
constructor () {
this.event = new EventEmmitter()
this.icons = {}
}
addIcon (mod) {
let self = this
this.view.appendChild(yo`<div id="${mod.name}Icon" class="${css.icon}" onclick=${(e) => { self._iconClick(mod.name) }} title=${mod.name}><img src="${mod.icon}" alt="${mod.name}" /></div>`)
this.icons[mod.name] = yo`<div class="${css.icon}" onclick=${(e) => { self._iconClick(mod.name) }} title=${mod.name}><img src="${mod.icon}" alt="${mod.name}" /></div>`
this.view.appendChild(this.icons[mod.name])
}
removeIcon (mod) {
var el = this.view.querySelector(`#${mod.name}Icon`)
el.parentElement.removeChild(el)
let el = this.icons[mod.name]
if (el) el.parentElement.removeChild(el)
}
select (name) {

Loading…
Cancel
Save