diff options
author | Markus Wüstenberg | 2021-06-08 18:12:04 +0200 |
---|---|---|
committer | GitHub | 2021-06-08 18:12:04 +0200 |
commit | ba0d83f4fb1b588f7931b9a31609807adfa11163 (patch) | |
tree | b5c04b590f3d584e8a66280c6d7c4aa7f2965fa5 /gomponents.go | |
parent | 7c0f2e4cbb4da6d7074bd78be9c55d3495c0dad7 (diff) | |
download | gomponents-ba0d83f4fb1b588f7931b9a31609807adfa11163.tar.lz gomponents-ba0d83f4fb1b588f7931b9a31609807adfa11163.tar.zst gomponents-ba0d83f4fb1b588f7931b9a31609807adfa11163.zip |
Add examples in test files (#80)
These show up in godoc.
Diffstat (limited to 'gomponents.go')
-rw-r--r-- | gomponents.go | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/gomponents.go b/gomponents.go index 9cf4297..5ac6939 100644 --- a/gomponents.go +++ b/gomponents.go @@ -1,4 +1,4 @@ -// Package gomponents provides declarative view components in Go, that can render to HTML5. +// Package gomponents provides view components in Go, that render to HTML 5. // The primary interface is a Node, which has a single function Render, which should render // the Node to a string. Furthermore, NodeFunc is a function which implements the Node interface // by calling itself on Render. @@ -219,14 +219,6 @@ func Group(children []Node) Node { } // Map something enumerable to a list of Nodes. -// Example: -// items := []string{"hat", "partyhat"} -// -// lis := Map(len(items), func(i int) Node { -// return El("li", Text(items[i])) -// }) -// -// list := El("ul", lis...) func Map(length int, cb func(i int) Node) []Node { var nodes []Node for i := 0; i < length; i++ { @@ -237,10 +229,6 @@ func Map(length int, cb func(i int) Node) []Node { // If condition is true, return the given Node. Otherwise, return nil. // This helper function is good for inlining elements conditionally. -// Example: -// El("div", -// If(showMessage, El("span", "You lost your hat.")), -// ) func If(condition bool, n Node) Node { if condition { return n |