Initial extraction of shared webui layout (base/navbar/sidebar/footer)
Pilot module for the shared design used by yasta, yasl, yaiam, yakwui, and yamase-web: server-rendered Bootstrap dashboard chrome, imported as a Go module instead of copy-pasted per project.
This commit is contained in:
commit
d722592379
11 files changed
+439
No files matched your search
@@ -0,0 +1,30 @@
|
||||
{{define "base"}}<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{.Title}}{{if .Name}} · {{.Name}}{{end}}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3E%3Crect%20width='100'%20height='100'%20rx='20'%20fill='%2314171e'/%3E%3Ctext%20x='50'%20y='71'%20font-size='58'%20font-family='system-ui,sans-serif'%20font-weight='700'%20fill='%230b82b8'%20text-anchor='middle'%3E{{.BrandInitial}}%3C/text%3E%3C/svg%3E">
|
||||
<link rel="stylesheet" href="{{.BasePath}}/webui-static/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="{{.BasePath}}/webui-static/style.css">
|
||||
<script src="{{.BasePath}}/webui-static/bootstrap.bundle.min.js" defer></script>
|
||||
{{.ExtraHeadHTML}}
|
||||
</head>
|
||||
<body>
|
||||
{{template "navbar" .}}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<nav class="col-md-2 col-lg-2 sidebar d-md-block">
|
||||
{{template "sidebar" .}}
|
||||
</nav>
|
||||
<main class="col-md-10 col-lg-10 ms-sm-auto px-md-4 py-3">
|
||||
{{if .Flash}}<div class="alert alert-{{if eq .FlashKind "ok"}}success{{else}}danger{{end}}">{{.Flash}}</div>{{end}}
|
||||
{{template "content" .}}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
{{.ExtraBodyHTML}}
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
@@ -0,0 +1,3 @@
|
||||
{{define "footer"}}
|
||||
<footer class="footer">{{.Name}} web UI · {{buildInfo}}</footer>
|
||||
{{end}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{define "navbar"}}
|
||||
<nav class="navbar navbar-dark navbar-expand">
|
||||
<div class="container-fluid d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex align-items-center">
|
||||
<a class="navbar-brand" href="{{.BasePath}}/">{{.Brand}}</a>
|
||||
{{if .Subtitle}}<span class="navbar-subtitle">{{.Subtitle}}</span>{{end}}
|
||||
{{.NavbarLeftExtra}}
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
{{if .Username}}<span class="navbar-subtitle">{{.Username}}</span>{{end}}
|
||||
{{if .LogoutPath}}<a href="{{.BasePath}}{{.LogoutPath}}" class="btn btn-outline-secondary btn-sm">Logout</a>{{end}}
|
||||
{{.NavbarRightExtra}}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{{end}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{define "sidebar"}}
|
||||
<div class="nav flex-column pt-2">
|
||||
{{range .NavItems}}<a class="nav-link{{if eq $.ActiveNav .ID}} active{{end}}" href="{{$.BasePath}}{{.Href}}">{{.Label}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
Reference in new issue
Block a user