catbase/bot/web/index.templ

58 lines
1.7 KiB
Plaintext

package web
templ (w *Web) Header(title string) {
<head>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/foundation-sites@6.8.1/dist/css/foundation.min.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="UTF-8" />
if title != "" {
<title>catbase - { title }</title>
} else {
<title>catbase</title>
}
</head>
}
templ (w *Web) Footer() {
<script src="//unpkg.com/htmx.org@1.9.10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/foundation-sites@6.8.1/dist/js/foundation.min.js"></script>
}
templ (w *Web) Index(title string, contents templ.Component) {
<!DOCTYPE html>
<html lang="en" class="no-js">
@w.Header(title)
<body>
@w.Nav(title)
if contents != nil {
@contents
}
@w.Footer()
</body>
</html>
}
templ (w *Web) Nav(currentPage string) {
<div class="top-bar">
<div class="top-bar-left">
<ul class="menu">
<li class="menu-text">{ w.botName() }</li>
for _, item := range w.GetWebNavigation() {
<li>
if currentPage == item.Name {
<a class="is-active" aria-current="page" href={ templ.URL(item.URL) }>{ item.Name }</a>
} else {
<a href={ templ.URL(item.URL) }>{ item.Name }</a>
}
</li>
}
</ul>
</div>
</div>
}