Add SongList
This commit is contained in:
parent
0b69162d0b
commit
7c6ba261f8
11
karaokatalog/ui/static/components/pieces/SongList.js
Normal file
11
karaokatalog/ui/static/components/pieces/SongList.js
Normal file
@ -0,0 +1,11 @@
|
||||
import Artist from "./Artist.js"
|
||||
import Pagination from "./Pagination.js"
|
||||
|
||||
export default {
|
||||
view: function (vnode) {
|
||||
const sortedSongs = vnode.attrs.songs.toSorted((a, b) => a.artist.localeCompare(b.artist) || a.title.localeCompare(b.title))
|
||||
const songsByArtist = Map.groupBy(sortedSongs, song => song.artist)
|
||||
|
||||
return m(Pagination, { elements: songsByArtist.entries().map(([artist, songs]) => m(Artist, { artist, songs })) })
|
||||
},
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user