package components
templ Layout(props LayoutProps) {
{ props.Title }
@Head(props.Head)
@Header(props.Header)
{ children... }
}
type LayoutProps struct {
Title string
Description string
Head HeadProps
Header HeaderProps
Footer FooterProps
}
type HeadProps struct {
Links []Link
Scripts []Script
}
type Link struct {
Href string
Rel string
}
type Script struct {
Src string
Defer bool
}
templ Head(props HeadProps) {
for _, link := range props.Links {
}
for _, script := range props.Scripts {
}
}
templ Header(props HeaderProps) {
@Topbar() {
@TopbarBrand(props.BrandName)
@TopbarCreateButton(props.CreateLabel, props.CreateHref)
@TopbarSearch(props.SearchPlaceholder)
@TopbarIconButton("Notifications") {
@IconBell()
}
@TopbarIconButton("User menu") {
@IconUser()
}
}
}
templ Topbar() {
}
templ TopbarLeft() {
{ children... }
}
templ TopbarBrand(brandName string) {
{ brandName }
}
templ TopbarCreateButton(label string, href string) {
if href != "" {
{ label }
} else {
}
}
templ TopbarCenter() {
{ children... }
}
templ TopbarSearch(placeholder string) {
}
templ TopbarRight() {
{ children... }
}
templ TopbarIconButton(ariaLabel string) {
}
type HeaderProps struct {
BrandName string
CreateLabel string
CreateHref string
SearchPlaceholder string
Routes []NavRoute
}
type NavRoute struct {
Name string
Path string
}
templ Footer(props FooterProps) {
}
type FooterProps struct {
}