git ssb

0+

Zach! / music-visions



Tree: 16b15178d85688fc180af5d4c05fe1b924fbb754

Files: 16b15178d85688fc180af5d4c05fe1b924fbb754 / views / songbook.js

748 bytesRaw
1const choo = require('choo')
2const html = require('choo/html')
3
4module.exports = view
5
6function 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: ${state.lastSong}</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