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
|
// API
|
||||||
class VerticalIconsApi { |
class VerticalIconsApi { |
||||||
|
|
||||||
constructor(verticalIconsComponent, pluginManagerComponent) { |
constructor (verticalIconsComponent, pluginManagerComponent) { |
||||||
this.component = verticalIconsComponent |
this.component = verticalIconsComponent |
||||||
pluginManagerComponent.event.on('requestContainer', (mod, content) => verticalIconsComponent.addIcon(mod) ) |
pluginManagerComponent.event.on('requestContainer', (mod, content) => verticalIconsComponent.addIcon(mod)) |
||||||
} |
} |
||||||
} |
} |
||||||
module.exports = VerticalIconsApi |
module.exports = VerticalIconsApi |
||||||
|
@ -1,44 +1,58 @@ |
|||||||
|
|
||||||
var yo = require('yo-yo') |
var yo = require('yo-yo') |
||||||
var csjs = require('csjs-inject') |
var csjs = require('csjs-inject') |
||||||
const remixLib = require('remix-lib') |
// const remixLib = require('remix-lib')
|
||||||
|
|
||||||
const styleguide = require('../ui/styles-guide/theme-chooser') |
// const styleguide = require('../ui/styles-guide/theme-chooser')
|
||||||
const styles = styleguide.chooser() |
// const styles = styleguide.chooser()
|
||||||
const EventEmmitter = require('events') |
const EventEmmitter = require('events') |
||||||
|
|
||||||
// Component
|
// Component
|
||||||
class VerticalIconComponent { |
class VerticalIconComponent { |
||||||
|
|
||||||
constructor() { |
constructor () { |
||||||
this.event = new EventEmmitter |
this.event = new EventEmmitter() |
||||||
} |
} |
||||||
|
|
||||||
addIcon (mod) { |
addIcon (mod) { |
||||||
let self = this |
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>`) |
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) { |
removeIcon (item) { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
select (name) { |
select (name) { |
||||||
this.event.emit('showContent', name) |
this.event.emit('showContent', name) |
||||||
} |
} |
||||||
|
|
||||||
_iconClick (name) { |
_iconClick (name) { |
||||||
// called when an icon has been clicked
|
// called when an icon has been clicked
|
||||||
this.event.emit('showContent', name) |
this.event.emit('showContent', name) |
||||||
} |
} |
||||||
|
|
||||||
render() { |
render () { |
||||||
this.view = yo` |
this.view = yo` |
||||||
<div id='icons'> |
<div class=${css.icons}> |
||||||
</div> |
</div> |
||||||
` |
` |
||||||
return this.view |
return this.view |
||||||
} |
|
||||||
} |
} |
||||||
|
} |
||||||
|
|
||||||
module.exports = VerticalIconComponent |
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