page.templ 649 B

123456789101112131415161718192021222324252627282930313233343536
  1. package naive
  2. import "fmt"
  3. templ base(title string, body templ.Component) {
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <style>
  8. html {
  9. max-width: 70ch;
  10. padding: 3em 1em;
  11. margin: auto;
  12. line-height: 1.75;
  13. font-size: 1.25em;
  14. }
  15. </style>
  16. <title>{ title }</title>
  17. </head>
  18. <body>
  19. <h1>{ title }</h1>
  20. @body
  21. </body>
  22. </html>
  23. }
  24. templ (i Impl) maze(body []string, links []link) {
  25. for _, paragraph := range body {
  26. <p>{ paragraph }</p>
  27. }
  28. <ul>
  29. for _, link := range links {
  30. <li><a href={ templ.SafeURL(fmt.Sprintf("./%s", link.href)) }>{ link.body }</a></li>
  31. }
  32. </ul>
  33. }