-
-
Save dawkot/9ad53b68f4bc62e977708771c5bd23f8 to your computer and use it in GitHub Desktop.
Karax problem
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
import strutils | |
include karax / prelude | |
type Foo = ref object | |
str: string | |
template foo(x): untyped = Foo(str: x) | |
var sequences: seq[seq[Foo]] | |
for i in 1..10: | |
sequences.add @[foo"foo", foo"bar", foo"baz", foo"xyz", foo"abc"] | |
setRenderer proc: VNode = | |
proc render(foo: Foo): VNode = buildHtml: | |
button(id=foo.str): | |
text foo.str | |
proc onClick = | |
if foo.str[0].isUpperAscii: | |
foo.str[0] = foo.str[0].toLowerAscii | |
else: | |
foo.str[0] = foo.str[0].toUpperAscii | |
buildHtml tdiv: | |
tdiv: | |
tdiv: | |
tdiv: | |
tdiv: | |
tdiv: | |
tdiv: | |
tdiv: | |
for s in sequences: | |
for foo in s: render foo | |
br() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment