84 lines
2.0 KiB
Go
84 lines
2.0 KiB
Go
package contact
|
|
|
|
import (
|
|
. "git.gorlug.de/code/ersteller"
|
|
|
|
. "maragu.dev/gomponents"
|
|
. "maragu.dev/gomponents/html"
|
|
)
|
|
|
|
const ContactPath = "/contact"
|
|
const ContactPathDe = "/kontakt"
|
|
|
|
var contactTexts *ContactTexts
|
|
|
|
type ContactTexts struct {
|
|
PageTitle I18nText
|
|
PageDescription I18nText
|
|
HeroTitle I18nText
|
|
HeroDescription I18nText
|
|
}
|
|
|
|
type Page struct {
|
|
createPage CreateHtmxPageFunc
|
|
ViewRoute HtmxRoute
|
|
}
|
|
|
|
func NewPage(createPage CreateHtmxPageFunc, server HtmxServer, path *ActivePath) *Page {
|
|
if contactTexts == nil {
|
|
createContactTexts()
|
|
}
|
|
page := &Page{
|
|
createPage: createPage,
|
|
}
|
|
page.ViewRoute = NewHtmxGetRoute(page.View, LanguagePaths{
|
|
En: ContactPath,
|
|
De: ContactPathDe,
|
|
}).SetActivePath(path)
|
|
page.ViewRoute.Add(server)
|
|
return page
|
|
}
|
|
|
|
func createContactTexts() {
|
|
contactTexts = &ContactTexts{
|
|
PageTitle: NewI18nText(map[Language]string{
|
|
En: "Contact",
|
|
De: "Kontakt",
|
|
}),
|
|
PageDescription: NewI18nText(map[Language]string{
|
|
En: "Get in touch with us",
|
|
De: "Nehmen Sie Kontakt mit uns auf",
|
|
}),
|
|
HeroTitle: NewI18nText(map[Language]string{
|
|
En: "Contact Us",
|
|
De: "Kontaktieren Sie uns",
|
|
}),
|
|
HeroDescription: NewI18nText(map[Language]string{
|
|
En: "This is a placeholder contact page. Add your contact information and forms here.",
|
|
De: "Dies ist eine Platzhalter-Kontakt-Seite. Fügen Sie hier Ihre Kontaktinformationen und Formulare hinzu.",
|
|
}),
|
|
}
|
|
}
|
|
|
|
func (p *Page) getMetaData() PageWebsiteMetaData {
|
|
return PageWebsiteMetaData{
|
|
Title: contactTexts.PageTitle,
|
|
Lang: En,
|
|
Description: contactTexts.PageDescription,
|
|
}
|
|
}
|
|
|
|
func (p *Page) View(c HtmxContext) {
|
|
content := ContactContent(c.GetLanguage())
|
|
p.createPage(c, p.getMetaData(), content)
|
|
}
|
|
|
|
func ContactContent(language Language) Group {
|
|
return []Node{
|
|
Div(Class("hero-section"),
|
|
H1(Class("hero-title"), Text(contactTexts.HeroTitle.FromLang(language))),
|
|
P(Class("hero-description"), Text(contactTexts.HeroDescription.FromLang(language))),
|
|
),
|
|
}
|
|
}
|