Files: 9f5c802ae0f19a653aa744af250402e6fb042fda / app / page / splash.js
1102 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 svg = assetPath('splash.svg') |
20 | console.log(svg) |
21 | |
22 | const style = { |
23 | 'background': require('../../assets/splash-svg.js'), |
24 | 'background-repeat': 'no-repeat', |
25 | 'background-size': 'contain' |
26 | } |
27 | |
28 | return h('Splash', [ |
29 | h('div.top', [ |
30 | h('img.logoName', { src: assetPath('logo_and_name.png') }) |
31 | ]), |
32 | h('div.bottom', { style }, [ |
33 | h('div.about', random(strings.splash.about)), |
34 | h('pre.slogan', strings.splash.slogan) |
35 | ]) |
36 | ]) |
37 | } |
38 | } |
39 | |
40 | function assetPath (name) { |
41 | return path.join(__dirname, '../../assets', name) |
42 | } |
43 | |
44 | function random (arr) { |
45 | const i = Math.floor(Math.random() * arr.length) |
46 | return arr[i] |
47 | } |
48 | |
49 |
Built with git-ssb-web