Commit 63fee5d6 authored by LianaHus's avatar LianaHus Committed by Liana Husikyan

style update after review

parent d89cfefd
...@@ -37,7 +37,7 @@ class CompilerContainer { ...@@ -37,7 +37,7 @@ class CompilerContainer {
} }
if (!this._view.compilationButton) return if (!this._view.compilationButton) return
const button = this.compilationButton(name.split('/').pop()) const button = this.compilationButton(name.split('/').pop())
this._disableCompileBtn(!name || name === '') this._disableCompileBtn(!name)
yo.update(this._view.compilationButton, button) yo.update(this._view.compilationButton, button)
} }
...@@ -104,27 +104,25 @@ class CompilerContainer { ...@@ -104,27 +104,25 @@ class CompilerContainer {
/************** /**************
* SUBCOMPONENT * SUBCOMPONENT
*/ */
compilationButton (name) { compilationButton (name = '') {
if (!name) name = '' const displayed = name || '<no file selected>'
const displayed = name === '' ? '<no file selected>' : name const disabled = name ? '' : 'disabled'
const disabled = name === '' ? 'disabled' : ''
const compileBtn = yo` const compileBtn = yo`
<button id="compileBtn" class="btn btn-primary btn-block ${disabled}" title="Compile" onclick="${this.compile.bind(this)}"> <button id="compileBtn" class="btn btn-primary btn-block ${disabled}" title="Compile" onclick="${this.compile.bind(this)}">
<span>${this._view.compileIcon} Compile ${displayed}</span> <span>${this._view.compileIcon} Compile ${displayed}</span>
</button> </button>
` `
let el = yo` return yo`
<div class="px-2 mt-2 pb-0 d-flex"> <div class="px-2 mt-2 pb-0 d-flex">
${compileBtn} ${compileBtn}
</div> </div>
` `
return el
} }
_disableCompileBtn (disable) { _disableCompileBtn (shouldDisable) {
let btn = document.querySelector("button[id='compileBtn']") let btn = document.getElementById('compileBtn')
if (!btn) return if (!btn) return
if (disable) { if (shouldDisable) {
btn.classList.add('disabled') btn.classList.add('disabled')
} else if (this.config.get('currentFile')) { } else if (this.config.get('currentFile')) {
btn.classList.remove('disabled') btn.classList.remove('disabled')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment