From 1475e5f95ef2f1746ba423c4f9ecd0bf03089bbd Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 4 Mar 2016 23:21:52 -0800 Subject: [PATCH] Use html "class" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of this PR (https://github.com/substack/hyperx/pull/22) to hyperx, attributes are automatically converted to properties for the few cases where they’re different: class, for, and http-equiv. --- renderer/views/app.js | 4 ++-- renderer/views/header.js | 14 +++++++------- renderer/views/player.js | 14 +++++++------- renderer/views/torrent-list.js | 23 ++++++++++++----------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/renderer/views/app.js b/renderer/views/app.js index b691ba06..ad257ca1 100644 --- a/renderer/views/app.js +++ b/renderer/views/app.js @@ -18,9 +18,9 @@ function App (state, dispatch) { } return hx` - +
${Header(state, dispatch)} - ${getView()}
+
${getView()}
` } diff --git a/renderer/views/header.js b/renderer/views/header.js index eb9bd3cf..d9bf393c 100644 --- a/renderer/views/header.js +++ b/renderer/views/header.js @@ -6,13 +6,13 @@ var hx = hyperx(h) function Header (state, dispatch) { return hx` - +
${getTitle()} - - chevron_left - chevron_right + - +
@@ -20,13 +20,13 @@ function Header (state, dispatch) { function getTitle () { if (process.platform === 'darwin') { - return hx`${state.view.title}` + return hx`
${state.view.title}
` } } function plusButton () { if (state.view.url !== '/player') { - return hx`add` + return hx`add` } } diff --git a/renderer/views/player.js b/renderer/views/player.js index 49c8f08b..d8bdb88a 100644 --- a/renderer/views/player.js +++ b/renderer/views/player.js @@ -26,7 +26,7 @@ function Player (state, dispatch) { // Show the video as large as will fit in the window, play immediately return hx` - +
- dispatch('playPause')}> + dispatch('playPause')}> ${state.video.isPaused ? 'play_arrow' : 'pause'} @@ -104,14 +104,14 @@ function renderLoadingBar (state) { // Output an list of rectangles to show loading progress return hx` - +
${parts.map(function (part) { var style = { left: (100 * part.start / numParts) + '%', width: (100 * part.count / numParts) + '%' } - return hx`
` + return hx`
` })} ` diff --git a/renderer/views/torrent-list.js b/renderer/views/torrent-list.js index 1c387bdd..e510d96c 100644 --- a/renderer/views/torrent-list.js +++ b/renderer/views/torrent-list.js @@ -11,7 +11,7 @@ function TorrentList (state, dispatch) { : [] var list = torrents.map((torrent) => renderTorrent(state, dispatch, torrent)) - return hx`${list}` + return hx`
${list}
` } // Renders a torrent in the torrent list @@ -29,14 +29,15 @@ function renderTorrent (state, dispatch, torrent) { var elements = [ renderTorrentMetadata(torrent), hx` - dispatch('deleteTorrent', torrent)}> close `, hx` dispatch('openPlayer', torrent)}> play_arrow @@ -46,7 +47,7 @@ function renderTorrent (state, dispatch, torrent) { if (state.view.chromecast) { elements.push(hx` dispatch('openChromecast', torrent)}> cast @@ -56,23 +57,23 @@ function renderTorrent (state, dispatch, torrent) { if (state.view.devices.airplay) { elements.push(hx` dispatch('openAirplay', torrent)}> airplay `) } - return hx`${elements}` + return hx`
${elements}
` } // Renders the torrent name and download progress function renderTorrentMetadata (torrent) { return hx` - - ${torrent.name || 'Loading torrent...'} - - ${Math.floor(100 * torrent.progress)}% +