about summary refs log tree commit diff stats
path: root/examples
diff options
context:
space:
mode:
authorMarkus Wüstenberg2021-05-05 09:03:16 +0200
committerGitHub2021-05-05 09:03:16 +0200
commit3b7dceab897709fe8243c605adea90ee771c49ff (patch)
tree78e5fd6151111dca6f60e9e365c79b897e0c4bca /examples
parent5d2f0f1b87aff69edf5b3a993afbb1ae2db946d0 (diff)
downloadgomponents-3b7dceab897709fe8243c605adea90ee771c49ff.tar.lz
gomponents-3b7dceab897709fe8243c605adea90ee771c49ff.tar.zst
gomponents-3b7dceab897709fe8243c605adea90ee771c49ff.zip
Streamline HTML element API (#66)
There were a lot of elements previously, like `Em`, `H1`, and a lot more, that took a string as the first argument previously. This was weird when you wanted to mix elements to output html like `<strong><em>…</em></strong>` or `<h1>Something <em>something</em> something</h1>`. gomponents is not an HTML validator, so I want people to be able to use elements however they please, also without text content.

This also means that all elements now have the same API.
Diffstat (limited to 'examples')
-rw-r--r--examples/simple/simple.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/simple/simple.go b/examples/simple/simple.go
index a6877f5..93aa28f 100644
--- a/examples/simple/simple.go
+++ b/examples/simple/simple.go
@@ -42,7 +42,7 @@ func Page(p props) g.Node {
 				{Path: "/foo", Name: "Foo"},
 				{Path: "/bar", Name: "Bar"},
 			}),
-			H1(p.title),
+			H1(g.Text(p.title)),
 			P(g.Textf("Welcome to the page at %v.", p.path)),
 		},
 	})