Added documentation to functions and basic JWT generation
This commit is contained in:
@@ -5,6 +5,7 @@ type FooterItem struct {
|
||||
href string
|
||||
}
|
||||
|
||||
// Specify the links to show in the footer
|
||||
func getFooterItems() []FooterItem {
|
||||
return []FooterItem{
|
||||
{
|
||||
@@ -18,6 +19,7 @@ func getFooterItems() []FooterItem {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the template fragment for the Footer
|
||||
templ Footer() {
|
||||
<footer class="bg-mantle mt-10">
|
||||
<div
|
||||
|
||||
@@ -2,6 +2,10 @@ package form
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Login Form. If loginError is not an empty string, it will display the
|
||||
// contents of loginError to the user.
|
||||
// If loginError is "Username or password incorrect" it will also show
|
||||
// error icons on the username and password field
|
||||
templ LoginForm(loginError string) {
|
||||
{{
|
||||
var errCreds string
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package nav
|
||||
|
||||
type NavItem struct {
|
||||
name string
|
||||
href string
|
||||
name string // Label to display
|
||||
href string // Link reference
|
||||
}
|
||||
|
||||
// Return the list of navbar links
|
||||
func getNavItems() []NavItem {
|
||||
return []NavItem{
|
||||
{
|
||||
@@ -14,6 +15,7 @@ func getNavItems() []NavItem {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the navbar template fragment
|
||||
templ Navbar() {
|
||||
{{ navItems := getNavItems() }}
|
||||
<div x-data="{ open: false }">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package nav
|
||||
|
||||
// Returns the left portion of the navbar
|
||||
templ navLeft(navItems []NavItem) {
|
||||
<nav aria-label="Global" class="hidden sm:block">
|
||||
<ul class="flex items-center gap-6 text-xl">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package nav
|
||||
|
||||
// Returns the right portion of the navbar
|
||||
templ navRight() {
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="sm:flex sm:gap-2">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package nav
|
||||
|
||||
// Returns the mobile version of the navbar thats only visible when activated
|
||||
templ sideNav(navItems []NavItem) {
|
||||
<div
|
||||
x-show="open"
|
||||
|
||||
@@ -3,6 +3,8 @@ package layout
|
||||
import "projectreshoot/view/component/nav"
|
||||
import "projectreshoot/view/component/footer"
|
||||
|
||||
// Global page layout. Includes HTML document settings, header tags
|
||||
// navbar and footer
|
||||
templ Global() {
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
|
||||
@@ -2,6 +2,7 @@ package page
|
||||
|
||||
import "projectreshoot/view/layout"
|
||||
|
||||
// Returns the about page content
|
||||
templ About() {
|
||||
@layout.Global() {
|
||||
<div class="text-center max-w-150 m-auto">
|
||||
|
||||
@@ -2,6 +2,9 @@ package page
|
||||
|
||||
import "projectreshoot/view/layout"
|
||||
|
||||
// Page template for Error pages. Error code should be a HTTP status code as
|
||||
// a string, and err should be the corresponding response title.
|
||||
// Message is a custom error message displayed below the code and error.
|
||||
templ Error(code string, err string, message string) {
|
||||
@layout.Global() {
|
||||
<div
|
||||
|
||||
@@ -2,6 +2,7 @@ package page
|
||||
|
||||
import "projectreshoot/view/layout"
|
||||
|
||||
// Page content for the index page
|
||||
templ Index() {
|
||||
@layout.Global() {
|
||||
<div class="text-center mt-24">
|
||||
|
||||
@@ -3,6 +3,7 @@ package page
|
||||
import "projectreshoot/view/layout"
|
||||
import "projectreshoot/view/component/form"
|
||||
|
||||
// Returns the login page
|
||||
templ Login() {
|
||||
@layout.Global() {
|
||||
<div class="max-w-100 mx-auto px-2">
|
||||
|
||||
Reference in New Issue
Block a user