From e8c4affa73f3e556981267ae4236561ece158ca1 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 21 Jan 2017 19:18:25 +0100 Subject: Fix compilation issues --- src/main/scala/reading/component/index/Book.scala | 48 ---------------------- .../scala/reading/component/index/BookDetail.scala | 48 ++++++++++++++++++++++ src/main/scala/reading/component/index/Books.scala | 8 ++-- .../scala/reading/component/index/style/Book.scala | 42 ------------------- .../reading/component/index/style/BookDetail.scala | 42 +++++++++++++++++++ 5 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 src/main/scala/reading/component/index/Book.scala create mode 100644 src/main/scala/reading/component/index/BookDetail.scala delete mode 100644 src/main/scala/reading/component/index/style/Book.scala create mode 100644 src/main/scala/reading/component/index/style/BookDetail.scala (limited to 'src') diff --git a/src/main/scala/reading/component/index/Book.scala b/src/main/scala/reading/component/index/Book.scala deleted file mode 100644 index ffa3c6b..0000000 --- a/src/main/scala/reading/component/index/Book.scala +++ /dev/null @@ -1,48 +0,0 @@ -package reading.component.index - -import scalatags.JsDom.all._ -import scalacss.Defaults._ -import scalacss.ScalatagsCss._ - -import reading.component.index.style.{ Book => BookStyle } -import reading.models.{ Program, Book => BookModel } - -object Book { - def apply(book: BookModel): HtmlTag = - div( - BookStyle.render, - BookStyle.detail, - - img( - BookStyle.cover, - src := s"cover/${book.title}.jpg" - ), - - div( - div(BookStyle.title, book.title), - div(BookStyle.author, s", ${book.author}"), - if (book.programs.nonEmpty) { - div( - item("classe", book.programs.map(Program.grade(_).prettyPrint).distinct.sorted.mkString(", ")), - item("programme", book.programs.map(p => "« " ++ p.prettyPrint ++ " »").sorted.mkString(", ")) - ) - }, - if (book.themes.nonEmpty) { - item("thème", book.themes.sorted.map(_.prettyPrint).mkString(", ")) - }, - if (book.genres.nonEmpty) { - item("genre", book.genres.sorted.map(_.prettyPrint).mkString(", ")) - }, - book.period.map { period => - item("période", period.prettyPrint) - } - ) - ) - - private def item(key: String, value: String): Frag = - div( - BookStyle.item, - span(BookStyle.itemKey, key), - span(BookStyle.itemValue, value) - ) -} diff --git a/src/main/scala/reading/component/index/BookDetail.scala b/src/main/scala/reading/component/index/BookDetail.scala new file mode 100644 index 0000000..6a9d83a --- /dev/null +++ b/src/main/scala/reading/component/index/BookDetail.scala @@ -0,0 +1,48 @@ +package reading.component.index + +import scalatags.JsDom.all._ +import scalacss.Defaults._ +import scalacss.ScalatagsCss._ + +import reading.component.index.style.{ BookDetail => BookStyle } +import reading.models.{ Program, Book } + +object BookDetail { + def apply(book: Book): HtmlTag = + div( + BookStyle.render, + BookStyle.detail, + + img( + BookStyle.cover, + src := s"cover/${book.title}.jpg" + ), + + div( + div(BookStyle.title, book.title), + div(BookStyle.author, s", ${book.author}"), + if (book.programs.nonEmpty) { + div( + item("classe", book.programs.map(Program.grade(_).prettyPrint).distinct.sorted.mkString(", ")), + item("programme", book.programs.map(p => "« " ++ p.prettyPrint ++ " »").sorted.mkString(", ")) + ) + }, + if (book.themes.nonEmpty) { + item("thème", book.themes.sorted.map(_.prettyPrint).mkString(", ")) + }, + if (book.genres.nonEmpty) { + item("genre", book.genres.sorted.map(_.prettyPrint).mkString(", ")) + }, + book.period.map { period => + item("période", period.prettyPrint) + } + ) + ) + + private def item(key: String, value: String): Frag = + div( + BookStyle.item, + span(BookStyle.itemKey, key), + span(BookStyle.itemValue, value) + ) +} diff --git a/src/main/scala/reading/component/index/Books.scala b/src/main/scala/reading/component/index/Books.scala index 50a05a9..5d7c92e 100644 --- a/src/main/scala/reading/component/index/Books.scala +++ b/src/main/scala/reading/component/index/Books.scala @@ -9,12 +9,12 @@ import scalacss.ScalatagsCss._ import reading.component.index.style.{ Books => BooksStyle } import reading.component.widget.Popup -import reading.models.{ Book => BookModel } +import reading.models.{ Book } import reading.utils.{ RxTag, RxAttr } object Books { - def apply(books: Rx[Seq[BookModel]]): Frag = { - val focus: Var[Option[BookModel]] = Var(None) + def apply(books: Rx[Seq[Book]]): Frag = { + val focus: Var[Option[Book]] = Var(None) div( BooksStyle.render, @@ -38,7 +38,7 @@ object Books { RxTag { implicit context => focus() match { - case Some(book) => Popup(onClose = focus() = None)(Book(book)) + case Some(book) => Popup(onClose = focus() = None)(BookDetail(book)) case None => span("") } } diff --git a/src/main/scala/reading/component/index/style/Book.scala b/src/main/scala/reading/component/index/style/Book.scala deleted file mode 100644 index 9f242eb..0000000 --- a/src/main/scala/reading/component/index/style/Book.scala +++ /dev/null @@ -1,42 +0,0 @@ -package reading.component.index.style - -import scalacss.Defaults._ - -import reading.component.style.Col - -object Book extends StyleSheet.Inline { - import dsl._ - - val title = style( - display.inlineBlock, - fontSize(18.px), - fontWeight.bold, - marginBottom(20.px), - color(Col.congoBrown) - ) - - val author = style( - display.inlineBlock - ) - - val detail = style( - display.flex - ) - - val cover = style( - height(300.px), - marginRight(30.px) - ) - - val item = style( - lineHeight(25.px), - marginBottom(4.px) - ) - - val itemKey = style( - fontWeight.bold, - marginRight(10.px) - ) - - val itemValue = style() -} diff --git a/src/main/scala/reading/component/index/style/BookDetail.scala b/src/main/scala/reading/component/index/style/BookDetail.scala new file mode 100644 index 0000000..e54c964 --- /dev/null +++ b/src/main/scala/reading/component/index/style/BookDetail.scala @@ -0,0 +1,42 @@ +package reading.component.index.style + +import scalacss.Defaults._ + +import reading.component.style.Col + +object BookDetail extends StyleSheet.Inline { + import dsl._ + + val title = style( + display.inlineBlock, + fontSize(18.px), + fontWeight.bold, + marginBottom(20.px), + color(Col.congoBrown) + ) + + val author = style( + display.inlineBlock + ) + + val detail = style( + display.flex + ) + + val cover = style( + height(300.px), + marginRight(30.px) + ) + + val item = style( + lineHeight(25.px), + marginBottom(4.px) + ) + + val itemKey = style( + fontWeight.bold, + marginRight(10.px) + ) + + val itemValue = style() +} -- cgit v1.2.3