36 lines
788 B
Text
36 lines
788 B
Text
|
|
-- DreamStack Router Example
|
||
|
|
-- Multi-page app with hash-based routing
|
||
|
|
|
||
|
|
let page_title = "DreamStack Router"
|
||
|
|
|
||
|
|
view nav = row [
|
||
|
|
button "Home" { click: navigate "/" }
|
||
|
|
button "About" { click: navigate "/about" }
|
||
|
|
button "Counter" { click: navigate "/counter" }
|
||
|
|
]
|
||
|
|
|
||
|
|
let count = 0
|
||
|
|
|
||
|
|
route "/" ->
|
||
|
|
column [
|
||
|
|
text "Welcome to DreamStack!"
|
||
|
|
text "Use the nav bar above to explore pages."
|
||
|
|
]
|
||
|
|
|
||
|
|
route "/about" ->
|
||
|
|
column [
|
||
|
|
text "About DreamStack"
|
||
|
|
text "A reactive UI language with fine-grained signals."
|
||
|
|
text "No virtual DOM. No dependency arrays. No re-renders."
|
||
|
|
]
|
||
|
|
|
||
|
|
route "/counter" ->
|
||
|
|
column [
|
||
|
|
text "Interactive Counter"
|
||
|
|
text count
|
||
|
|
button "+" { click: count += 1 }
|
||
|
|
button "-" { click: count -= 1 }
|
||
|
|
when count > 10 ->
|
||
|
|
text "Double digits!"
|
||
|
|
]
|