Files
readeck/components/layout.go
T
Olivier Meunier 150596399f Templ sunrise
- Updated makefile so "make serve" watches for .templ files and
    rebuild files upon changes
- Added a "templ" make target
- Added a top level "components" module
- Added a "components/forms" module
- Added server.RenderComponent method
- Added server.RenderTurboStreamComponent
- Preferences lazy loading

We're now ready to roll!
2026-05-04 11:23:29 +02:00

40 lines
1.1 KiB
Go

// SPDX-FileCopyrightText: © 2026 Olivier Meunier <olivier@neokraft.net>
//
// SPDX-License-Identifier: AGPL-3.0-only
package components
import "github.com/a-h/templ"
// BasePage renders an empty page with default and required head elements.
func BasePage(title string) templ.Component {
return defaultLayout.BasePage(title)
}
// SideMenuLayout renders a page with a side menu.
func SideMenuLayout(title string, sidemenu templ.Component) templ.Component {
return defaultLayout.SideMenuLayout(title, sidemenu, defaultLayout.SideMenuWrapper())
}
// SideMenuStdLayout renders a page with a side menu.
// The content has a standard maximum width.
func SideMenuStdLayout(title string, sidemenu templ.Component) templ.Component {
return defaultLayout.SideMenuLayout(title, sidemenu, defaultLayout.SideMenuStdWrapper())
}
// Layout is our base layout for every Readeck page.
type Layout struct {
Head templ.Component
}
// defaultLayout is an instance of [Layout] that we reuse
// about everywhere.
var defaultLayout = NewLayout()
// NewLayout returns a new [Layout].
func NewLayout() (l *Layout) {
return &Layout{
Head: templ.NopComponent,
}
}