jolheiser.com/site_templ.go

175 lines
5.1 KiB
Go

// Code generated by templ@(devel) DO NOT EDIT.
package main
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
func head() templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
var_1 := templ.GetChildren(ctx)
if var_1 == nil {
var_1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, err = templBuffer.WriteString("<head><title>")
if err != nil {
return err
}
var_2 := `jolheiser`
_, err = templBuffer.WriteString(var_2)
if err != nil {
return err
}
_, err = templBuffer.WriteString("</title><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"shortcut icon\" href=\"https://www.gravatar.com/avatar/7f4dd86f017ff289cf05a013e22357ef253d1ed6a52bdefca8f965af1080a965?s=16\"><meta name=\"author\" content=\"jolheiser\"><link rel=\"stylesheet\" href=\"styles.css\"></head>")
if err != nil {
return err
}
if !templIsBuffer {
_, err = templBuffer.WriteTo(w)
}
return err
})
}
func fill(hex string) string {
return "#" + hex
}
func body(links []Link) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
var_3 := templ.GetChildren(ctx)
if var_3 == nil {
var_3 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, err = templBuffer.WriteString("<body class=\"latte dark:mocha bg-base\"><header class=\"relative w-full pt-16 pb-10\"><img class=\"mx-auto rounded-full\" alt=\"avatar\" src=\"https://www.gravatar.com/avatar/7f4dd86f017ff289cf05a013e22357ef253d1ed6a52bdefca8f965af1080a965?s=125\"><p class=\"mt-2 text-xl text-center text-lavender\">")
if err != nil {
return err
}
var var_4 string = `@`
_, err = templBuffer.WriteString(templ.EscapeString(var_4))
if err != nil {
return err
}
var_5 := `jolheiser`
_, err = templBuffer.WriteString(var_5)
if err != nil {
return err
}
_, err = templBuffer.WriteString("</p></header><nav class=\"relative max-w-screen-sm mx-auto\">")
if err != nil {
return err
}
for _, link := range links {
_, err = templBuffer.WriteString("<a class=\"flex relative px-3 py-2 my-6 h-16 text-lg items-center justify-center text-text bg-surface0 cursor-pointer rounded border-solid border-2 border-overlay0 hover:bg-surface2 hover:border-lavender hover:text-blue transition\" href=\"")
if err != nil {
return err
}
var var_6 templ.SafeURL = templ.SafeURL(link.URL)
_, err = templBuffer.WriteString(templ.EscapeString(string(var_6)))
if err != nil {
return err
}
_, err = templBuffer.WriteString("\" rel=\"me noopener noreferrer\" title=\"")
if err != nil {
return err
}
_, err = templBuffer.WriteString(templ.EscapeString(link.Name))
if err != nil {
return err
}
_, err = templBuffer.WriteString("\" target=\"_blank\"><svg class=\"absolute left-5 w-10 h-10\" role=\"img\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><title>")
if err != nil {
return err
}
var var_7 string = link.Icon().Title
_, err = templBuffer.WriteString(templ.EscapeString(var_7))
if err != nil {
return err
}
_, err = templBuffer.WriteString("</title><path fill=\"")
if err != nil {
return err
}
_, err = templBuffer.WriteString(templ.EscapeString(fill(link.Icon().Hex)))
if err != nil {
return err
}
_, err = templBuffer.WriteString("\" d=\"")
if err != nil {
return err
}
_, err = templBuffer.WriteString(templ.EscapeString(link.Icon().Path))
if err != nil {
return err
}
_, err = templBuffer.WriteString("\"></path></svg><span>")
if err != nil {
return err
}
var var_8 string = link.Name
_, err = templBuffer.WriteString(templ.EscapeString(var_8))
if err != nil {
return err
}
_, err = templBuffer.WriteString("</span></a>")
if err != nil {
return err
}
}
_, err = templBuffer.WriteString("</nav></body>")
if err != nil {
return err
}
if !templIsBuffer {
_, err = templBuffer.WriteTo(w)
}
return err
})
}
func index(links []Link) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
var_9 := templ.GetChildren(ctx)
if var_9 == nil {
var_9 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
err = head().Render(ctx, templBuffer)
if err != nil {
return err
}
err = body(links).Render(ctx, templBuffer)
if err != nil {
return err
}
if !templIsBuffer {
_, err = templBuffer.WriteTo(w)
}
return err
})
}