don't calculate styles in JavaScript whenever possible

This commit is contained in:
Feross Aboukhadijeh
2016-03-05 22:06:32 -08:00
parent f161a7c7e7
commit e0122f81e5
3 changed files with 14 additions and 12 deletions

View File

@@ -8,14 +8,11 @@ function Header (state, dispatch) {
var hideControls = state.url === '/player' &&
state.video.mouseStationarySince !== 0 &&
new Date().getTime() - state.video.mouseStationarySince > 2000
var navLeftStyle = (process.platform === 'darwin' && !state.isFullScreen)
? { marginLeft: '78px' } /* OSX needs room on the left for min/max/close buttons */
: {} /* On Windows and Linux, the header is separate & underneath the title bar */
return hx`
<div class='header ${hideControls ? 'hide' : ''}'>
${getTitle()}
<div class='nav left' style=${navLeftStyle}>
<div class='nav left'>
<i
class='icon back'
title='back'