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