/
AboutPage.js
57 lines (49 loc) · 1.72 KB
/
AboutPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const {Page, TextView, contentView} = require('tabris');
const CoversGalleryPage = require('./CoversGalleryPage');
const TITLE = 'About';
const LICENSE_TEXT = 'Book covers under CC BY 2.0';
const COVERS_LINK_TEXT = 'Covers on flickr';
const ATTRIBUTION_TEXT =
`<i>Authors of book covers:</i><br/>
Paula Rodriguez - 1984<br/>
Marc Storrs and Rob Morphy - Na Tropie Nieznanych<br/>
Cat Finnie - Stary Czlowiek I Morze<br/>
Andrew Brozyna - Hobbit<br/>
Viacheslav Vystupov - Wojna Swiatow<br/>
Marc Storrs and Rob Morphy - Zegar Pomaranczowy Pracz<br/>
Andrew Evan Harner - Ksiega Dzungli`;
module.exports = class AboutPage extends Page {
constructor(properties) {
super(Object.assign({title: TITLE}, properties));
this.on({
appear: () => contentView.find('#aboutAction').first().visible = false,
disappear: () => contentView.find('#aboutAction').first().visible = true
});
this._createUI();
this._applyLayout();
this._applyStyles();
}
_createUI() {
this.append(
new TextView({id: 'licenseLabel', text: LICENSE_TEXT}),
new TextView({id: 'coversLink', text: COVERS_LINK_TEXT})
.on('tap', () => this._showCoversGallery()),
new TextView({id: 'attributionLabel',text: ATTRIBUTION_TEXT, markupEnabled: true})
);
}
_showCoversGallery() {
new CoversGalleryPage().appendTo(contentView.find('NavigationView').first());
}
_applyLayout() {
this.apply({
'#licenseLabel': {left: 16, right: 16, top: 16},
'#coversLink': {left: 16, right: 16, top: 'prev() 8',},
'#attributionLabel': {left: 16, right: 16, top: 'prev() 8'}
});
}
_applyStyles() {
this.apply({
'#coversLink': {textColor: 'rgba(71, 161, 238, 0.75)'}
});
}
};