all repos — gomponents @ 12acb8041060306b361109b46f9f05dbb4382ea0

HTML components in pure Go

Add full example app (#204) Also, remove the other examples and simplify the readme.

Markus Wüstenberg
commit

12acb8041060306b361109b46f9f05dbb4382ea0

parent

69b0da41dff1813f3939cf4ea09fbbb2d06b7719

1 file changed, 20 insertions(+), 0 deletions(-)

changed files
A internal/examples/app/html/home.go
@@ -0,0 +1,20 @@
+package html + +import ( + . "github.com/maragudk/gomponents" + . "github.com/maragudk/gomponents/html" +) + +func HomePage(items []string) Node { + return page("Home", + H1(Text("Home")), + + P(Text("This is a gomponents example app!")), + + P(Raw(`Have a look at the <a href="https://github.com/maragudk/gomponents/tree/main/internal/examples/app">source code</a> to see how it’s structured.`)), + + Ul(Group(Map(items, func(s string) Node { + return Li(Text(s)) + }))), + ) +}