1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package reading.component.index
import rx._
import scalatags.JsDom.all._
import scalacss.Defaults._
import scalacss.ScalatagsCss._
import reading.component.index.style.{Books => BooksStyle}
import reading.models.{Book, Program}
import reading.utils.RxTag
object Books {
def apply(books: Rx[Seq[Book]]): Frag =
div(
BooksStyle.render,
RxTag { implicit context =>
div(
div(
BooksStyle.count,
s"${books().length} livres"
),
books().sorted.map { book =>
div(
BooksStyle.book,
div(BooksStyle.title, book.title),
div(BooksStyle.author, s", ${book.author}"),
div(
BooksStyle.detail,
img(
BooksStyle.cover,
src := s"cover/${book.title}.jpg"
),
div(
div(BooksStyle.item, s"classe : ${book.programs.map(Program.grade).distinct.sorted.mkString(", ")}"),
div(BooksStyle.item, s"programme : ${book.programs.map(p => "« " ++ p.toString ++ " »").sorted.mkString(", ")}"),
div(BooksStyle.item, s"thème : ${book.themes.sorted.mkString(", ")}"),
div(BooksStyle.item, s"genre : ${book.genres.sorted.mkString(", ")}"),
book.period.map { period =>
div(BooksStyle.item, s"période : $period")
}
)
)
)
}
)
}
)
}
|