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