Files: 59dd32b5a83df3b3e243a5bc34f33072e25a9701 / app / page / splash.js
1039 bytesRaw
1 | const nest = require('depnest') |
2 | const { h } = require('mutant') |
3 | const path = require('path') |
4 | |
5 | exports.gives = nest('app.page.splash') |
6 | |
7 | exports.needs = nest({ |
8 | 'translations.sync.strings': 'first' |
9 | }) |
10 | |
11 | exports.create = (api) => { |
12 | return nest('app.page.splash', splash) |
13 | |
14 | function splash (location) { |
15 | // location is an object { feed, page: 'splash', callback } |
16 | |
17 | const strings = api.translations.sync.strings() |
18 | |
19 | const style = { |
20 | 'background': require('../../assets/splash-svg.js'), |
21 | 'background-repeat': 'no-repeat', |
22 | 'background-size': 'contain' |
23 | } |
24 | |
25 | return h('Splash', [ |
26 | h('div.top', [ |
27 | h('img.logoName', { src: assetPath('logo_and_name.png') }) |
28 | ]), |
29 | h('div.bottom', { style }, [ |
30 | h('div.slogan', strings.splash.slogan), |
31 | h('div.about', random(strings.splash.about)) |
32 | ]) |
33 | ]) |
34 | } |
35 | } |
36 | |
37 | function assetPath (name) { |
38 | return path.join(__dirname, '../../assets', name) |
39 | } |
40 | |
41 | function random (arr) { |
42 | const i = Math.floor(Math.random() * arr.length) |
43 | return arr[i] |
44 | } |
45 |
Built with git-ssb-web