This repository was archived by the owner on Mar 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
101 lines (86 loc) · 2.07 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* Module dependencies.
*/
var Label = require('framer-uilabel')
var dirname = __dirname === '/' ? '' : __dirname
/**
* iOS status bar for your prototyping pleasure.
*
* @class
* @param {Object} options
* @param {string} options.style=dark - `dark` means "dark content"
*/
module.exports = class StatusBar extends Layer {
constructor(options={}) {
options.style = options.style || 'dark'
var padding = 6
var fontSize = `12px`
var textColor = 'black'
super(_.extend(options, {
name: 'statusBar',
width: Screen.width,
height: 20,
backgroundColor: 'transparent'
}))
var networkSignal = new Layer({
name: 'networkSignal',
superLayer: this,
height: 6,
width: 34,
x: padding,
midY: this.midY,
image: `${dirname}/images/statusBarSignal.svg`
})
var networkName = new Label({
name: 'networkName',
superLayer: this,
x: networkSignal.maxX + 4,
midY: this.midY,
text: 'Framer',
fontSize: fontSize,
color: textColor
})
var wifi = new Layer({
name: 'wifi',
superLayer: this,
width: 14,
height: 10,
x: networkName.maxX + 4,
midY: this.midY,
image: `${dirname}/images/statusBarWifi.svg`
})
var time = new Label({
name: 'time',
superLayer: this,
midX: this.midX,
midY: this.midY,
text: '9:41 AM',
fontSize: fontSize,
color: textColor
})
var battery = new Layer({
name: 'battery',
superLayer: this,
width: 25,
height: 10,
maxX: this.width - padding,
midY: this.midY,
image: `${dirname}/images/statusBarBattery.svg`
})
var batteryPercentage = new Label({
name: 'batteryPercentage',
superLayer: this,
text: '100%',
maxX: battery.x - 3,
midY: this.midY,
fontSize: fontSize,
color: textColor
})
this.style = options.style
}
get style() { return this._style }
set style(value) {
this._style = value
this.invert = (value == 'dark') ? 0 : 100
}
}