mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-20 09:46:01 -05:00
templates: migrate OIDC callback to elem-go
Replace html/template with type-safe elem-go templating for OIDC callback page. Improves consistency with other templates and provides compile-time safety. All UI elements and styling preserved.
This commit is contained in:
committed by
Kristoffer Dalby
parent
d14be8d43b
commit
89285c317b
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/chasefleming/elem-go/styles"
|
||||
)
|
||||
|
||||
// bodyStyle provides consistent body styling across all templates with
|
||||
// a centered, readable layout and appropriate spacing.
|
||||
var bodyStyle = styles.Props{
|
||||
styles.Margin: "40px auto",
|
||||
styles.MaxWidth: "800px",
|
||||
@@ -13,31 +15,35 @@ var bodyStyle = styles.Props{
|
||||
styles.FontSize: "16px",
|
||||
styles.Color: "#444",
|
||||
styles.Padding: "0 10px",
|
||||
styles.FontFamily: "Sans-serif",
|
||||
styles.FontFamily: "sans-serif",
|
||||
}
|
||||
|
||||
// headerStyle provides consistent header styling with improved line height
|
||||
var headerStyle = styles.Props{
|
||||
styles.LineHeight: "1.2",
|
||||
}
|
||||
|
||||
// headerOne creates a level 1 heading with consistent styling
|
||||
func headerOne(text string) *elem.Element {
|
||||
return elem.H1(attrs.Props{attrs.Style: headerStyle.ToInline()}, elem.Text(text))
|
||||
}
|
||||
|
||||
// headerTwo creates a level 2 heading with consistent styling
|
||||
func headerTwo(text string) *elem.Element {
|
||||
return elem.H2(attrs.Props{attrs.Style: headerStyle.ToInline()}, elem.Text(text))
|
||||
}
|
||||
|
||||
// headerThree creates a level 3 heading with consistent styling
|
||||
func headerThree(text string) *elem.Element {
|
||||
return elem.H3(attrs.Props{attrs.Style: headerStyle.ToInline()}, elem.Text(text))
|
||||
}
|
||||
|
||||
// HtmlStructure creates a complete HTML document structure with proper meta tags
|
||||
// and semantic HTML5 structure. The head and body elements are passed as parameters
|
||||
// to allow for customization of each page.
|
||||
func HtmlStructure(head, body *elem.Element) *elem.Element {
|
||||
return elem.Html(nil,
|
||||
elem.Head(
|
||||
attrs.Props{
|
||||
attrs.Lang: "en",
|
||||
},
|
||||
return elem.Html(attrs.Props{attrs.Lang: "en"},
|
||||
elem.Head(nil,
|
||||
elem.Meta(attrs.Props{
|
||||
attrs.Charset: "UTF-8",
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user