made it shorter again
This commit is contained in:
parent
8bdaab3f82
commit
91679f8ae6
1 changed files with 8 additions and 13 deletions
|
|
@ -35,9 +35,7 @@ proc createTableCell(id: cstring): VNode =
|
|||
text id
|
||||
|
||||
proc createTableRow(item: TableItemState): VNode =
|
||||
var className = cstring"TableRow"
|
||||
if item.active:
|
||||
className = cstring"TableRow active"
|
||||
let className = if item.active: cstring"TableRow active" else: cstring"TableRow"
|
||||
result = buildHtml(tr(class=className, `data-id` = &item.id)):
|
||||
createTableCell("#" & &item.id)
|
||||
for i in 0..<len(item.props):
|
||||
|
|
@ -51,33 +49,30 @@ proc tableCreateVNode(data: TableState): VNode =
|
|||
|
||||
proc createAnimBox(item: AnimBoxState): VNode =
|
||||
let time = item.time
|
||||
let dataId: cstring = &item.id
|
||||
let color: float = float(time mod 10) / 10
|
||||
let divStyles: cstring = "border-radius: " & &(time mod 10) & "px; background: rgba(0,0,0," & cstring($color) & ")"
|
||||
result = flatHtml(tdiv(class="AnimBox", `data-id`=dataId, style=divStyles))
|
||||
let t10 = time mod 10
|
||||
let color = float(t10) / 10
|
||||
let divStyles = cstring"border-radius: " & &t10 &
|
||||
"px; background: rgba(0,0,0," & cstring($color) & ")"
|
||||
result = flatHtml(tdiv(class="AnimBox", `data-id` = &item.id, style=divStyles))
|
||||
|
||||
proc animCreateVNode(data: AnimState): VNode =
|
||||
result = buildHtml(tdiv(class="Anim")):
|
||||
for child in data.items:
|
||||
createAnimBox(child)
|
||||
|
||||
proc createTreeLeaf(data: TreeNodeState): VNode =
|
||||
result = buildHtml(li(class="TreeLeaf")):
|
||||
text &data.id
|
||||
|
||||
proc createTreeNode(data: TreeNodeState): VNode =
|
||||
result = buildHtml(ul(class="TreeNode")):
|
||||
for n in data.children:
|
||||
if n.container:
|
||||
createTreeNode(n)
|
||||
else:
|
||||
createTreeLeaf(n)
|
||||
li(class="TreeLeaf"):
|
||||
text &n.id
|
||||
|
||||
proc treeCreateVNode(data: TreeState): VNode =
|
||||
result = buildHtml(tdiv(class="Tree")):
|
||||
createTreeNode(data.root)
|
||||
|
||||
|
||||
proc update(): VNode =
|
||||
assert appState != nil
|
||||
let location = appState.location
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue