Native windows get lighter when they’re backgrounded so they stand out less (at least on OS X). Let’s do this too. Even the Spotify app, which has dozens of developers gets this wrong. We’re so awesome :) Also: - Renamed a bunch of state variables (next time will make separate commit, sry) - All window-related variables (e.g. isFullScreen, isFocused, etc.) live in `state.window` now - Remove negative class name, use CSS :not() instead
50 lines
1014 B
JavaScript
50 lines
1014 B
JavaScript
module.exports = Header
|
|
|
|
var h = require('virtual-dom/h')
|
|
var hyperx = require('hyperx')
|
|
var hx = hyperx(h)
|
|
|
|
function Header (state, dispatch) {
|
|
return hx`
|
|
<div class='header'>
|
|
${getTitle()}
|
|
<div class='nav left'>
|
|
<i
|
|
class='icon back'
|
|
title='back'
|
|
onclick=${() => dispatch('back')}>
|
|
chevron_left
|
|
</i>
|
|
<i
|
|
class='icon forward'
|
|
title='forward'
|
|
onclick=${() => dispatch('forward')}>
|
|
chevron_right
|
|
</i>
|
|
</div>
|
|
<div class='nav right'>
|
|
${getAddButton()}
|
|
</div>
|
|
</div>
|
|
`
|
|
|
|
function getTitle () {
|
|
if (process.platform === 'darwin') {
|
|
return hx`<div class='title'>${state.window.title}</div>`
|
|
}
|
|
}
|
|
|
|
function getAddButton () {
|
|
if (state.url !== '/player') {
|
|
return hx`
|
|
<i
|
|
class='icon add'
|
|
title='add torrent'
|
|
onclick=${() => dispatch('addTorrent')}>
|
|
add
|
|
</i>
|
|
`
|
|
}
|
|
}
|
|
}
|