fox-send/app/templates/activeBackground/index.js

15 lines
393 B
JavaScript
Raw Normal View History

2018-06-19 19:58:42 +00:00
const html = require('choo/html');
const assets = require('../../../common/assets');
2018-06-20 22:23:15 +00:00
module.exports = function(state) {
if (!state.backgroundUrl) {
const backgrounds = assets.match(/background/);
state.backgroundUrl =
backgrounds[Math.floor(Math.random() * backgrounds.length)];
}
2018-06-19 19:58:42 +00:00
return html`<div class="background">
2018-06-20 22:23:15 +00:00
<img src="${state.backgroundUrl}">
2018-06-19 19:58:42 +00:00
</div>`;
};