diff options
author | Joris | 2017-03-04 12:30:50 +0100 |
---|---|---|
committer | Joris | 2017-03-04 12:30:50 +0100 |
commit | f466c27fedc73e37132259930efad4f25d01f0b9 (patch) | |
tree | c427ae50ecd6e62f2726c810d706f23cba46e802 | |
parent | d38f069dc6e98c19382b29e99c8ebfd9e370fd78 (diff) |
Transform global style from Scala to CSS
-rw-r--r-- | public/global.css | 26 | ||||
-rw-r--r-- | public/index.html | 1 | ||||
-rw-r--r-- | src/main/scala/reading/Main.scala | 13 | ||||
-rw-r--r-- | src/main/scala/reading/component/index/style/Books.scala | 2 | ||||
-rw-r--r-- | src/main/scala/reading/component/index/style/Menu.scala | 5 | ||||
-rw-r--r-- | src/main/scala/reading/component/style/Global.scala | 36 | ||||
-rw-r--r-- | src/main/scala/reading/models/Books.scala | 2 |
7 files changed, 36 insertions, 49 deletions
diff --git a/public/global.css b/public/global.css new file mode 100644 index 0000000..d9a82c3 --- /dev/null +++ b/public/global.css @@ -0,0 +1,26 @@ +html { + box-sizing: border-box; +} + +body { + position: absolute; + width: 100%; + height: 100%; +} + +a { + color: inherit; +} + +*, *:before, *:after { + box-sizing: inherit; +} + +button { + cursor: pointer; + display: flex; + background-color: initial; + color: black; + border: none; + font-size: inherit; +} diff --git a/public/index.html b/public/index.html index 8e2599d..587080b 100644 --- a/public/index.html +++ b/public/index.html @@ -6,6 +6,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> <title>Conseils de lecture</title> <link rel="stylesheet" href="reset.css"> + <link rel="stylesheet" href="global.css"> <link rel="icon" href="icon.png"> <script src="main.js"></script> </head> diff --git a/src/main/scala/reading/Main.scala b/src/main/scala/reading/Main.scala index b97abd2..66e9ce1 100644 --- a/src/main/scala/reading/Main.scala +++ b/src/main/scala/reading/Main.scala @@ -1,26 +1,21 @@ package reading -import scala.scalajs.js.JSApp +import org.scalajs.dom import rx._ import rx.Ctx.Owner.Unsafe._ -import org.scalajs.dom -import scalacss.Defaults._ +import scala.scalajs.js.JSApp -import reading.component.style.{ Global => GlobalStyle } import reading.utils.RxUtils._ object Main extends JSApp { def main(): Unit = { - val style = dom.document.createElement("style") - style.appendChild(dom.document.createTextNode(GlobalStyle.render)) - dom.document.head.appendChild(style) - - val _ = dom.document.body.appendChild { + dom.document.body.appendChild { Rx { Route.current() match { case Route.Books(filters, detail) => component.Index(filters, detail) } }.render } + () } } diff --git a/src/main/scala/reading/component/index/style/Books.scala b/src/main/scala/reading/component/index/style/Books.scala index 808b937..0a0dd3e 100644 --- a/src/main/scala/reading/component/index/style/Books.scala +++ b/src/main/scala/reading/component/index/style/Books.scala @@ -21,7 +21,7 @@ object Books extends StyleSheet.Inline { ) val listParent = style( - overflowY.scroll, + overflowY.auto, paddingTop(15.px) ) diff --git a/src/main/scala/reading/component/index/style/Menu.scala b/src/main/scala/reading/component/index/style/Menu.scala index d824a1a..3fac8df 100644 --- a/src/main/scala/reading/component/index/style/Menu.scala +++ b/src/main/scala/reading/component/index/style/Menu.scala @@ -10,14 +10,15 @@ object Menu extends StyleSheet.Inline { val menu = style( height(100.%%), - zIndex(1), Media.desktop( backgroundColor(C.englishWalnut.value), color(C.white.value), position.relative, - width(280.px) + width(280.px), + boxShadow := "4px 0px 6px -1px rgba(0, 0, 0, 0.2)" ), Media.mobile( + zIndex(1), backgroundColor(C.white.value), color(C.black.value), position.fixed, diff --git a/src/main/scala/reading/component/style/Global.scala b/src/main/scala/reading/component/style/Global.scala deleted file mode 100644 index 9551424..0000000 --- a/src/main/scala/reading/component/style/Global.scala +++ /dev/null @@ -1,36 +0,0 @@ -package reading.component.style - -import scalacss.Defaults._ - -import reading.component.style.{ Color => C } - -object Global extends StyleSheet.Standalone { - import dsl._ - - "html" - ( - boxSizing.borderBox - ) - - "body" - ( - position.absolute, - width(100.%%), - height(100.%%) - ) - - "a" - ( - color(inherit) - ) - - "*, *:before, *:after" - ( - boxSizing.inherit - ) - - "button" - ( - cursor.pointer, - display.flex, - backgroundColor(initial), - color(C.black.value), - border.none, - fontSize.inherit - ) -} diff --git a/src/main/scala/reading/models/Books.scala b/src/main/scala/reading/models/Books.scala index 0f5043d..ae8a074 100644 --- a/src/main/scala/reading/models/Books.scala +++ b/src/main/scala/reading/models/Books.scala @@ -926,7 +926,7 @@ object Books { genres = Seq(Fantasy), themes = Seq(Aventure, Combat), programs = Seq(), - level = Moyen, + level = Difficile, summary = Some(""" """) ), |