blob: 6f44ff7a00c03d17232905c2ab42855714cbc944 (
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
|
// @flow
import React from 'react';
import {
Component,
Text,
Button,
View
} from 'reactxp';
import Img from './Img';
import styles from './HeaderBarStyles';
import platformStyles from './HeaderBarPlatformStyles';
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'],
platformStyles[process.platform],
styles['style_' + this.props.style]
];
if(this.props.hidden) {
containerClass.push(styles['hidden']);
}
return (
<View style={ containerClass }>
{!this.props.hidden ?
<View style={styles.container} testName="headerbar__container">
<Img height={50} width={50} source='logo-icon'/>
<Text style={styles.title}>MULLVAD VPN</Text>
</View>
: null}
{this.props.showSettings ?
<Button style={ styles.settings } onPress={ this.props.onSettings } testName="headerbar__settings">
<Img height={24} width={24} source='icon-settings' style={[ styles.settings_icon, platformStyles.settings_icon ]} hoverStyle={ styles.settings_icon_hover }/>
</Button>
: null}
</View>
);
}
}
|