parent
944a1a08db
commit
ba65b9544d
@ -1,16 +1,9 @@ |
||||
var yo = require('yo-yo') |
||||
var csjs = require('csjs-inject') |
||||
const remixLib = require('remix-lib') |
||||
|
||||
const styleguide = require('../ui/styles-guide/theme-chooser') |
||||
const styles = styleguide.chooser() |
||||
|
||||
// API
|
||||
class VerticalIconsApi { |
||||
|
||||
constructor(verticalIconsComponent, pluginManagerComponent) { |
||||
constructor (verticalIconsComponent, pluginManagerComponent) { |
||||
this.component = verticalIconsComponent |
||||
pluginManagerComponent.event.on('requestContainer', (mod, content) => verticalIconsComponent.addIcon(mod) ) |
||||
}
|
||||
pluginManagerComponent.event.on('requestContainer', (mod, content) => verticalIconsComponent.addIcon(mod)) |
||||
} |
||||
} |
||||
module.exports = VerticalIconsApi |
||||
|
@ -1,44 +1,58 @@ |
||||
|
||||
var yo = require('yo-yo') |
||||
var csjs = require('csjs-inject') |
||||
const remixLib = require('remix-lib') |
||||
// const remixLib = require('remix-lib')
|
||||
|
||||
const styleguide = require('../ui/styles-guide/theme-chooser') |
||||
const styles = styleguide.chooser() |
||||
// const styleguide = require('../ui/styles-guide/theme-chooser')
|
||||
// const styles = styleguide.chooser()
|
||||
const EventEmmitter = require('events') |
||||
|
||||
// Component
|
||||
class VerticalIconComponent { |
||||
|
||||
constructor() { |
||||
this.event = new EventEmmitter |
||||
} |
||||
|
||||
addIcon (mod) { |
||||
let self = this |
||||
this.view.appendChild(yo`<div onclick=${(e) => { self._iconClick(mod.name)}} title=${mod.name}><img src="${mod.icon}" alt="${mod.name}" /></div>`) |
||||
} |
||||
|
||||
removeIcon (item) { |
||||
|
||||
} |
||||
|
||||
select (name) { |
||||
this.event.emit('showContent', name) |
||||
} |
||||
|
||||
_iconClick (name) { |
||||
// called when an icon has been clicked
|
||||
this.event.emit('showContent', name) |
||||
} |
||||
|
||||
render() { |
||||
this.view = yo` |
||||
<div id='icons'> |
||||
</div> |
||||
` |
||||
return this.view |
||||
} |
||||
} |
||||
|
||||
module.exports = VerticalIconComponent |
||||
|
||||
// Component
|
||||
class VerticalIconComponent { |
||||
|
||||
constructor () { |
||||
this.event = new EventEmmitter() |
||||
} |
||||
|
||||
addIcon (mod) { |
||||
let self = this |
||||
this.view.appendChild(yo`<div class="${css.icon}" onclick=${(e) => { self._iconClick(mod.name) }} title=${mod.name}><img src="${mod.icon}" alt="${mod.name}" /></div>`) |
||||
} |
||||
|
||||
removeIcon (item) { |
||||
|
||||
} |
||||
|
||||
select (name) { |
||||
this.event.emit('showContent', name) |
||||
} |
||||
|
||||
_iconClick (name) { |
||||
// called when an icon has been clicked
|
||||
this.event.emit('showContent', name) |
||||
} |
||||
|
||||
render () { |
||||
this.view = yo` |
||||
<div class=${css.icons}> |
||||
</div> |
||||
` |
||||
return this.view |
||||
} |
||||
} |
||||
|
||||
module.exports = VerticalIconComponent |
||||
|
||||
const css = csjs` |
||||
.icons { |
||||
margin-left: 10px; |
||||
margin-top: 15px; |
||||
} |
||||
.icon { |
||||
cursor: pointer; |
||||
margin-bottom: 25px; |
||||
} |
||||
.icon img { |
||||
width: 25px; |
||||
} |
||||
` |
||||
|
Loading…
Reference in new issue