blob: 29de23522fd28283804fa3c781a90135b5b7d421 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
const sortedBooks = books.sort((a, b) =>
a.authorsSort == b.authorsSort
? a.date > b.date
: a.authorsSort > b.authorsSort)
const view = h('div',
{ className: 'g-Books' },
...sortedBooks.map(book => h('img', { className: 'g-Book', src: book.cover })))
document.body.appendChild(view)
// Helpers
function h(tagName, attrs, ...children) {
let elem = document.createElement(tagName)
elem = Object.assign(elem, attrs)
for (const child of children) elem.append(child)
return elem
}
|