Skip to content

Commit bec8b7f

Browse files
committed
Adding some demos to React Split Pane Component
1 parent c2ff61b commit bec8b7f

File tree

4 files changed

+94
-2
lines changed

4 files changed

+94
-2
lines changed

demo/images/reactSplitPane.png

-16.3 KB
Loading
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package demo.components.reactsplitpane
2+
3+
import chandu0101.macros.tojs.GhPagesMacros
4+
import chandu0101.scalajs.react.components.reactsplitpane.ReactSplitPane
5+
import demo.components.CodeExample
6+
import japgolly.scalajs.react._
7+
import japgolly.scalajs.react.vdom.html_<^._
8+
9+
object ReactSplitPaneSimpleHorizontal {
10+
11+
val code = GhPagesMacros.exampleSource
12+
13+
// EXAMPLE:START
14+
15+
class Backend(t: BackendScope[_, _]) {
16+
17+
def render() = {
18+
19+
<.div(
20+
CodeExample(code, "Simple Vertical Split")(
21+
<.div(
22+
^.width := "95%",
23+
^.height := "400px",
24+
^.border := "1px solid",
25+
^.margin := "auto",
26+
^.position := "relative",
27+
ReactSplitPane(
28+
split = "horizontal"
29+
)(<.div("first"), <.div("second"))
30+
)
31+
)
32+
)
33+
}
34+
}
35+
36+
val component = ScalaComponent.builder[Unit]("ReactSplitPaneDemo")
37+
.renderBackend[Backend]
38+
.build
39+
40+
// EXAMPLE:END
41+
42+
def apply() = component()
43+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package demo.components.reactsplitpane
2+
3+
import chandu0101.macros.tojs.GhPagesMacros
4+
import chandu0101.scalajs.react.components.reactsplitpane.ReactSplitPane
5+
import demo.components.CodeExample
6+
import japgolly.scalajs.react._
7+
import japgolly.scalajs.react.vdom.html_<^._
8+
9+
object ReactSplitPaneSimpleNested {
10+
11+
val code = GhPagesMacros.exampleSource
12+
13+
// EXAMPLE:START
14+
15+
class Backend(t: BackendScope[_, _]) {
16+
17+
def render() = {
18+
19+
val vert = ReactSplitPane()(<.div("second"), <.div("third"))
20+
21+
<.div(
22+
CodeExample(code, "Simple Nested")(
23+
<.div(
24+
^.width := "95%",
25+
^.height := "400px",
26+
^.border := "1px solid",
27+
^.margin := "auto",
28+
^.position := "relative",
29+
ReactSplitPane(
30+
split = "horizontal"
31+
)(<.div("first"), vert)
32+
)
33+
)
34+
)
35+
}
36+
}
37+
38+
val component = ScalaComponent.builder[Unit]("ReactSplitPaneDemo")
39+
.renderBackend[Backend]
40+
.build
41+
42+
// EXAMPLE:END
43+
44+
def apply() = component()
45+
}

demo/src/main/scala/demo/routes/ReactSplitPaneRouteModule.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package demo.routes
22

3-
import demo.components.reactsplitpane.{ReactSplitPaneInfo, ReactSplitPaneSimpleVertical}
3+
import demo.components.reactsplitpane._
44
import demo.pages.ReactSplitPanePage
55
import japgolly.scalajs.react.extra.router.RouterConfigDsl
66
import japgolly.scalajs.react.vdom.html_<^._
@@ -11,7 +11,11 @@ object ReactSplitPaneRouteModule {
1111

1212
case object SimpleVertical extends LeftRoute("Simple Vertical", "simplevertical", () => ReactSplitPaneSimpleVertical())
1313

14-
val menu: List[LeftRoute] = List(Info, SimpleVertical)
14+
case object SimpleHorizontal extends LeftRoute("Simple Horizontal", "simplehorizontal", () => ReactSplitPaneSimpleHorizontal())
15+
16+
case object SimpleNested extends LeftRoute("Simple Nested", "simplenested", () => ReactSplitPaneSimpleNested())
17+
18+
val menu: List[LeftRoute] = List(Info, SimpleVertical, SimpleHorizontal, SimpleNested)
1519

1620
val routes = RouterConfigDsl[LeftRoute].buildRule { dsl =>
1721
import dsl._

0 commit comments

Comments
 (0)