Last active
August 29, 2015 14:21
-
-
Save zlangbert/76ed8a0382054a29e5d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Props(color: String, onClick: Unit => Unit) | |
class Backend($: BackendScope[Props, _]) { | |
def onClick(e: ReactEventI) = { | |
println("clicked!") | |
$.props.onClick() | |
} | |
val circ = ReactComponentB[Props]("CircleComponent") | |
.stateless | |
.backend(new Backend(_)) | |
.render((props, _, b) => | |
div( | |
svg(width := 800, height := 100, | |
g(transform := "translate(100, 0)", | |
onKeyPress ==> b.onClick, | |
circle( | |
cx := "25", cy := "25", r := "25", fill := props.color) | |
) | |
) | |
) | |
) | |
.build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment