aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/reading/component/widget/Popup.scala
diff options
context:
space:
mode:
authorJoris2017-01-21 14:29:56 +0100
committerJoris2017-01-21 14:29:56 +0100
commit6b7074fde5feb7d1dfe543ffa45f79dd0daa45fe (patch)
tree825813a6ceed67a3f4ea4f09a43b33ff55537758 /src/main/scala/reading/component/widget/Popup.scala
parent7895302e6b8f7ec11675b4a08f87cbbfd2a2587c (diff)
downloadreading-6b7074fde5feb7d1dfe543ffa45f79dd0daa45fe.tar.gz
reading-6b7074fde5feb7d1dfe543ffa45f79dd0daa45fe.tar.bz2
reading-6b7074fde5feb7d1dfe543ffa45f79dd0daa45fe.zip
Show only book covers in search page and show detail when clicking on its
Diffstat (limited to 'src/main/scala/reading/component/widget/Popup.scala')
-rw-r--r--src/main/scala/reading/component/widget/Popup.scala45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/scala/reading/component/widget/Popup.scala b/src/main/scala/reading/component/widget/Popup.scala
new file mode 100644
index 0000000..8e40d36
--- /dev/null
+++ b/src/main/scala/reading/component/widget/Popup.scala
@@ -0,0 +1,45 @@
+package reading.component.widget
+
+import org.scalajs.dom
+
+import rx._
+import Ctx.Owner.Unsafe._
+
+import scalatags.JsDom.all._
+import scalacss.Defaults._
+import scalacss.ScalatagsCss._
+
+import reading.component.widget.style.{ Popup => PopupStyle }
+import reading.component.style.Col
+import reading.utils.{ RxAttr }
+
+object Popup {
+ def apply(onClose: => Unit)(content: HtmlTag): HtmlTag = {
+ dom.document.body.style.overflowY = "hidden"
+
+ div(
+ PopupStyle.render,
+ PopupStyle.popup,
+
+ div(
+ PopupStyle.curtain,
+ RxAttr(onclick, Rx(() => close(onClose)))
+ ),
+
+ div(
+ PopupStyle.content,
+ content,
+ div(
+ PopupStyle.cross,
+ RxAttr(onclick, Rx(() => close(onClose))),
+ Cross(20.px, Col.stiletto)
+ )
+ )
+ )
+ }
+
+ private def close(onClose: => Unit): Unit = {
+ dom.document.body.style.overflowY = "scroll"
+ onClose
+ }
+}