diff options
Diffstat (limited to '')
-rw-r--r-- | templ/base.tpl | 1 | ||||
-rw-r--r-- | templ/content.tpl | 78 | ||||
-rw-r--r-- | templ/index.tpl | 2 | ||||
-rw-r--r-- | templ/navlinks.tpl | 8 | ||||
-rw-r--r-- | templ/template.go | 2 |
5 files changed, 37 insertions, 54 deletions
diff --git a/templ/base.tpl b/templ/base.tpl index 9d8d1c2..c96f2a9 100644 --- a/templ/base.tpl +++ b/templ/base.tpl @@ -5,6 +5,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/svg+xml" href="/static/favicon.svg" sizes="16x16 32x32 48x48"> <title>{{block "title" .}}Kosten{{end}}</title> + <link href="/static/custom.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> <script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> {{block "head" .}}{{end}} diff --git a/templ/content.tpl b/templ/content.tpl index 4486047..74cba58 100644 --- a/templ/content.tpl +++ b/templ/content.tpl @@ -1,62 +1,36 @@ {{define "body"}} + {{/* different inline svgs */}} <svg xmlns="http://www.w3.org/2000/svg" class="d-none"> - <symbol id="list" viewBox="0 0 16 16"> - <path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"></path> - </symbol> <symbol id="search" viewBox="0 0 16 16"> <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path> </symbol> </svg> - <header class="navbar sticky-top bg-dark flex-md-nowrap p-0 shadow"> - <div class="p-1 ms-2 d-flex align-items-center"> - <img src="/static/euro-money.svg" alt="Logo" width="32" height="32"/> - <span class="fs-6 text-white py-1 ms-3">Kosten</span> - </div> - <ul class="navbar-nav flex-row d-md-none"> - <li class="nav-item text-nowrap"> - <button class="nav-link px-3 text-white" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSearch" aria-controls="navbarSearch" aria-expanded="false" aria-label="Toggle search"> - <svg class="bi"><use xlink:href="#search"></use></svg> - </button> - </li> - <li class="nav-item text-nowrap"> - <button class="nav-link px-3 text-white" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation"> - <svg class="bi"><use xlink:href="#list"></use></svg> - </button> - </li> - </ul> - - <div id="navbarSearch" class="navbar-search w-100 collapse"> - <input class="form-control w-100 rounded-0 border-0" type="text" placeholder="Search" aria-label="Search"> - </div> - </header> - <div class="container-fluid"> - <div class="row"> - <div class="sidebar border border-right col-md-3 col-lg-2 p-3 bg-body-tertiary"> - <nav id="sidebarMenu" class="offcanvas-md offcanvas-end" tabindex="-1"> - <div class="offcanvas-header"> - <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#sidebarMenu" aria-label="Close"></button> - </div> - Kosten - </nav> - </div> - <main class="col-md-9 ms-sm-auto"> - <div> - Foo - </div> - </main> + {{/* The Navbar */}} + <nav class="navbar sticky-top bg-dark-subtle navbar-expand-lg shadow mb-2"> + <div class="container-fluid" > + <a class="navbar-brand" href="#"> + <img src="/static/euro-money.svg" alt="Logo" width="32" height="32" class="d-inline-block"/> Kosten + </a> + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarNav"> + <ul class="navbar-nav me-auto"> + {{template "navlinks"}} + </ul> + <form class="d-flex" role="search"> + <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-dark" type="submit"><svg class="svg"><use xlink:href="#search"></use></svg></button> + </form> + </div> </div> - </div> -{{end}} + </nav> -{{define "head"}} - <style> - .bi { - display: inline-block; - width: 1rem; - height: 1rem; - vertical-align: -.125em; - fill: currentColor; - } - </style> + {{/* The Main Content */}} + <main class="container-lg"> + {{block "main" .}} + Dummy Content + {{end}} + </main> {{end}}
\ No newline at end of file diff --git a/templ/index.tpl b/templ/index.tpl index 013c5ea..76016bb 100644 --- a/templ/index.tpl +++ b/templ/index.tpl @@ -1,3 +1,3 @@ -{{define "body"}} +{{define "main"}} Logged in with user: {{.}} {{end}}
\ No newline at end of file diff --git a/templ/navlinks.tpl b/templ/navlinks.tpl new file mode 100644 index 0000000..0d71d7e --- /dev/null +++ b/templ/navlinks.tpl @@ -0,0 +1,8 @@ +{{define "navlinks"}} + <li class="nav-item"> + <a class="nav-link" href="/categories">Kategorien</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/constant">Konstante Kosten</a> + </li> +{{end}}
\ No newline at end of file diff --git a/templ/template.go b/templ/template.go index 9def1b8..f609bc4 100644 --- a/templ/template.go +++ b/templ/template.go @@ -32,7 +32,7 @@ func checkLive() bool { func loadBase(fs fs.FS) { baseTpl = template.Must(template.New("base.tpl"). Funcs(form.FuncMap()). - ParseFS(fs, "base.tpl", "form.tpl")) + ParseFS(fs, "base.tpl", "form.tpl", "navlinks.tpl", "content.tpl")) formBuilder = form.Builder{InputTemplate: baseTpl.Lookup("formItem")} baseTpl.Funcs(formBuilder.FuncMap()) } |