package templates import "veola/internal/models" // Page is the data carrier for any rendered page; concrete handlers populate // only the fields they use. type Page struct { Title string Active string CSRFToken string CurrentUser *models.User Flash string FlashError string } templ head(title string) { { title } ยท Veola } templ Sidebar(active string) { } func navClass(key, active string) string { if key == active { return "active" } return "" } templ Layout(p Page, body templ.Component) { @head(p.Title) @Sidebar(p.Active)
if p.Flash != "" {
{ p.Flash }
} if p.FlashError != "" {
{ p.FlashError }
} @body
} // Bare is a chrome-less layout used by /login and /setup. templ Bare(p Page, body templ.Component) { @head(p.Title) @body } // CSRFInput is the hidden form field for state-changing forms. templ CSRFInput(token string) { }