added background image

This commit is contained in:
Danny Coates 2018-06-19 12:58:42 -07:00
parent fdef37287d
commit 211b1a8576
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
8 changed files with 47 additions and 8 deletions

View File

@ -13,13 +13,9 @@
}
html {
background: url('../assets/send_bg.svg');
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'segoe ui',
'helvetica neue', helvetica, ubuntu, roboto, noto, arial, sans-serif;
font-weight: 200;
background-size: 110%;
background-repeat: no-repeat;
background-position: center top;
}
body {
@ -225,6 +221,7 @@ a {
}
.title {
color: var(--textColor);
font-size: 33px;
line-height: 40px;
margin: 20px auto;

View File

@ -1,4 +1,5 @@
@import './base.css';
@import './templates/activeBackground/activeBackground.css';
@import './templates/header/header.css';
@import './templates/downloadButton/downloadButton.css';
@import './templates/progress/progress.css';

View File

@ -5,6 +5,7 @@ const download = require('./download');
const header = require('../templates/header');
const footer = require('../templates/footer');
const fxPromo = require('../templates/fxPromo');
const activeBackground = require('../templates/activeBackground');
nanotiming.disabled = true;
const app = choo();
@ -18,6 +19,7 @@ function banner(state, emit) {
function body(template) {
return function(state, emit) {
const b = html`<body>
${activeBackground(state, emit)}
${banner(state, emit)}
${header(state)}
<main class="main">

View File

@ -0,0 +1,11 @@
.background {
position: absolute;
left: 0;
top: 0;
height: 100%;
z-index: -1;
}
.background > img {
height: 100%;
}

View File

@ -0,0 +1,10 @@
const html = require('choo/html');
const assets = require('../../../common/assets');
module.exports = function() {
const backgrounds = assets.match(/background/);
const src = backgrounds[Math.floor(Math.random() * backgrounds.length)];
return html`<div class="background">
<img src="${src}">
</div>`;
};

BIN
assets/background_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

BIN
assets/background_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -15,15 +15,33 @@ function getAsset(name) {
return prefix + assets[name];
}
function getMatches(match) {
return Object.keys(assets)
.filter(k => match.test(k))
.map(getAsset);
}
const instance = {
get: getAsset,
match: getMatches,
setMiddleware: function(middleware) {
function getManifest() {
return JSON.parse(
middleware.fileSystem.readFileSync(
middleware.getFilenameFromUrl('/manifest.json')
)
);
}
if (middleware) {
instance.get = function getAssetWithMiddleware(name) {
const f = middleware.fileSystem.readFileSync(
middleware.getFilenameFromUrl('/manifest.json')
);
return prefix + JSON.parse(f)[name];
const m = getManifest();
return prefix + m[name];
};
instance.match = function matchAssetWithMiddleware(match) {
const m = getManifest();
return Object.keys(m)
.filter(k => match.test(k))
.map(k => prefix + m[k]);
};
}
}