From 0483053febaa75cc016c1430ed6491456305a623 Mon Sep 17 00:00:00 2001 From: serapath Date: Tue, 10 Apr 2018 18:37:24 +0100 Subject: [PATCH] refactor analysis tab --- src/app/tabs/analysis-tab.js | 38 +++++++++++++++++----- src/app/tabs/styles/analysis-tab-styles.js | 26 --------------- 2 files changed, 29 insertions(+), 35 deletions(-) delete mode 100644 src/app/tabs/styles/analysis-tab-styles.js diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 6dea63f56c..f2bda461ca 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -1,12 +1,32 @@ var yo = require('yo-yo') -var css = require('./styles/analysis-tab-styles') +var csjs = require('csjs-inject') +var remixLib = require('remix-lib') -function analysisTab (api = {}, events = {}, opts = {}) { - var el = yo` -
-
- ` - return { render () { return el } } -} +var EventManager = remixLib.EventManager -module.exports = analysisTab +module.exports = class AnalysisTab { + constructor (opts = { api: {}, events: {} }) { + const self = this + self.event = new EventManager() + self._api = opts.api + self._events = opts.events + self._view = { el: null } + self.data = {} + self._components = {} + } + render () { + const self = this + if (self._view.el) return self._view.el + self._view.el = yo` +
` + return self._view.el + } +} +const css = csjs` + .analysisTabView { + padding: 2%; + padding-bottom: 3em; + display: flex; + flex-direction: column; + } +` diff --git a/src/app/tabs/styles/analysis-tab-styles.js b/src/app/tabs/styles/analysis-tab-styles.js deleted file mode 100644 index 7d9080ed03..0000000000 --- a/src/app/tabs/styles/analysis-tab-styles.js +++ /dev/null @@ -1,26 +0,0 @@ -// -------------- styling ---------------------- -var csjs = require('csjs-inject') -var styleGuide = require('../../ui/styles-guide/theme-chooser') -var styles = styleGuide.chooser() - -var css = csjs` - .analysisTabView { - padding: 2%; - padding-bottom: 3em; - display: flex; - flex-direction: column; - } - #staticanalysisView { - display: block; - } - .infoBox { - ${styles.infoTextBox} - margin-bottom: 1em; - } - .textBox { - ${styles.textBoxL} - margin-bottom: 1em; - } -` - -module.exports = css