Files: dcdd419466873a3da024459b543976e3c28ebf5e / views / songbook.js
862 bytesRaw
1 | const choo = require('choo') |
2 | const html = require('choo/html') |
3 | |
4 | module.exports = view |
5 | |
6 | function view (state, emit) { |
7 | emit('DOMTitleChange', 'Songbook') |
8 | return trackListing(state) |
9 | |
10 | function trackListing(state, emit) { |
11 | console.log({songList: state.songList}) |
12 | return html` |
13 | <div class='wrapper'> |
14 | <div class='paper'> |
15 | <h1>M U S I C V I S I O N S </h1> |
16 | <div id='tracklist'> |
17 | <ul> |
18 | ${state.songList.map(listTracks)} |
19 | </ul> |
20 | </div> |
21 | <h1>Last Track: ${state.lastSong}</h1> |
22 | </div> |
23 | </div> |
24 | ` |
25 | } |
26 | function listTracks (song) { |
27 | console.log('listin tracks') |
28 | return html` |
29 | <li>${song.title}</li> |
30 | ` |
31 | } |
32 | |
33 | function change (data) { |
34 | console.log(data.target.innerHTML) |
35 | song = data.target.innerHTML |
36 | emit('changeSong',song) |
37 | } |
38 | function close (data) { |
39 | console.log(data) |
40 | } |
41 | } |
42 | |
43 | |
44 |
Built with git-ssb-web