Skip to content

Commit

Permalink
Fix selected tab background color
Browse files Browse the repository at this point in the history
  • Loading branch information
ninabreznik authored and yann300 committed Oct 4, 2017
1 parent fb3dda1 commit 9b551f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/app/files/file-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var css = csjs`
.folder,
.file {
font-size : 14px;
cursor : pointer;
}
.hasFocus {
background-color : ${styles.colors.backgroundBlue};
Expand Down
7 changes: 0 additions & 7 deletions src/app/panels/righthand-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ var css = csjs`
min-width: 60px;
font-size: 0.9em;
cursor: pointer;
background-color: ${styles.colors.transparent};
font-size: 1em;
text-align: center;
}
Expand All @@ -61,12 +60,6 @@ var css = csjs`
margin: 0;
padding: 0;
}
.opts_li:active {
background-color: ${styles.colors.backgroundBlue};
}
.opts_li a {
color: inherit;
}
.opts_li {
display: block;
}
Expand Down
24 changes: 19 additions & 5 deletions src/app/tabs/tabbed-menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
var $ = require('jquery')

// -------------- styling ----------------------
var csjs = require('csjs-inject')
var remix = require('ethereum-remix')
var styleGuide = remix.ui.styleGuide
var styles = styleGuide()

module.exports = tabbedMenu

var css = csjs`
.active {
background-color: ${styles.colors.backgroundBlue};
}
`

function tabbedMenu (container, appAPI, events, opts) {
var lis = container.querySelectorAll('li')
for (var li = 0; li < lis.length; ++li) {
Expand All @@ -20,15 +32,17 @@ function tabbedMenu (container, appAPI, events, opts) {
selectTab(container.querySelector('.compileView'))

// select tab

function selectTab (el) {
el = $(el)
var match = /[a-z]+View/.exec(el.get(0).className)
var match = /[a-z]+View/.exec(el.className)
if (!match) return
var cls = match[0]
if (!el.hasClass('active')) {
el.parent().find('li').removeClass('active')
if (!el.classList.contains(css.active)) {
el.parentNode.querySelectorAll('li').forEach(function (x) {
x.classList.remove(css.active)
})
$('#optionViews').attr('class', '').addClass(cls)
el.addClass('active')
el.classList.add(css.active)
}
events.app.trigger('tabChanged', [cls])
}
Expand Down

0 comments on commit 9b551f4

Please sign in to comment.