-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresenterView.js
113 lines (100 loc) · 2.31 KB
/
presenterView.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
102
103
104
105
106
107
108
109
110
111
112
113
const html = require('choo/html')
const css = require('sheetify')
const bodyView = require('./bodyView')
const slideView = require('./slideView')
const numberView = require('./numberView')
const slideProgressView = require('./slideProgressView')
const clockView = require('./clockView')
const stopWatchView = require('./stopWatchView')
const key = require('keymaster')
const prefix = css`
:host {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
width: 100%;
height: 100%;
position: relative;
}
.gutter {
width: 5%;
flex: none;
}
.top {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 70px;
flex: 1 1;
}
.middle {
display: flex;
flex-wrap: nowrap;
justify-content: space-around;
align-items: center;
position: relative;
}
.slide {
position: relative;
flex: 1 1;
}
.empty-slide {
margin: 0;
height: 100%;
width: 100%;
background: black;
}
.bottom {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 70px;
flex: 1 1;
}
`
function view (state, emit) {
key.setScope('presenter')
return bodyView([
html`
<div class=${prefix}>
<div class="top">
<div class="gutter"></div>
${clockView()}
<div class="gutter"></div>
${stopWatchView()}
<div class="gutter"></div>
</div>
<div class="middle">
<div class="gutter"></div>
<div class="current slide">
${currentSlide(state, emit)}
</div>
<div class="gutter"></div>
<div class="next slide">
${nextSlide(state, emit)}
</div>
<div class="gutter"></div>
</div>
<div class="bottom">
${slideProgressView(state)}
</div>
</div>
`
])
}
function currentSlide (state, emit) {
const slide = state.slides[state.currentSlide - 1]
return [slideView(slide, emit), numberView(slide.number)]
}
function nextSlide (state, emit) {
const slide = state.slides[state.currentSlide]
if (slide) {
return [slideView(slide, emit), numberView(slide.number)]
} else {
return html`
<div class="empty-slide"> </div>
`
}
}
module.exports = view