blob: c2e02cc35cf29dfe5b5a3060f02b0c41a90d8745 (
plain)
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
58
59
60
61
|
// @flow
import React from 'react';
import {
Component,
Text,
Button,
View
} from 'reactxp';
import Img from './Img';
import styles from './HeaderBarStyles';
export type HeaderBarStyle = 'default' | 'defaultDark' | 'error' | 'success';
export type HeaderBarProps = {
style: HeaderBarStyle;
hidden: boolean;
showSettings: boolean;
onSettings: ?(() => void);
};
export default class HeaderBar extends Component {
props: HeaderBarProps;
static defaultProps: $Shape<HeaderBarProps> = {
style: 'default',
hidden: false,
showSettings: false,
onSettings: null
};
render() {
let containerClass = [
styles['headerbar'],
styles['headerbar__' + process.platform],
styles['headerbar__style_' + this.props.style]
];
if(this.props.hidden) {
containerClass.push(styles['headerbar__hidden']);
}
return (
<View style={ containerClass }>
{!this.props.hidden ?
<View style={styles.headerbar__container} testName="headerbar__container">
<Img style={ styles.headerbar__logo } source='logo-icon'/>
<Text style={styles.headerbar__title}>MULLVAD VPN</Text>
</View>
: null}
{this.props.showSettings ?
<View style={styles.headerbar__settings}>
<Button onPress={ this.props.onSettings } testName="headerbar__settings">
<Img style={ styles.headerbar__settings } source='icon-settings'/>
</Button>
</View>
: null}
</View>
);
}
}
|