blob: 8e40d36b76d55c4ae784445d6ef4e31e63ab1cf7 (
plain)
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
|
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
}
}
|