Add white label template for starter
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
package index
|
||||
|
||||
import (
|
||||
. "ersteller-lib"
|
||||
|
||||
. "maragu.dev/gomponents"
|
||||
. "maragu.dev/gomponents/html"
|
||||
)
|
||||
|
||||
const IndexPath = "/"
|
||||
const IndexPathDe = "/"
|
||||
|
||||
var indexTexts *IndexTexts
|
||||
|
||||
type IndexTexts struct {
|
||||
PageTitle I18nText
|
||||
PageDescription I18nText
|
||||
WelcomeTitle I18nText
|
||||
WelcomeText I18nText
|
||||
FeaturesTitle I18nText
|
||||
FeaturesText I18nText
|
||||
ContactTitle I18nText
|
||||
ContactText I18nText
|
||||
}
|
||||
|
||||
type Page struct {
|
||||
createPage CreateHtmxPageFunc
|
||||
ViewRoute HtmxRoute
|
||||
}
|
||||
|
||||
func NewPage(createPage CreateHtmxPageFunc, server HtmxServer, path *ActivePath) *Page {
|
||||
if indexTexts == nil {
|
||||
createIndexTexts()
|
||||
}
|
||||
page := &Page{
|
||||
createPage: createPage,
|
||||
}
|
||||
page.ViewRoute = NewHtmxGetRoute(page.View, LanguagePaths{
|
||||
En: IndexPath,
|
||||
De: IndexPathDe,
|
||||
}).SetActivePath(path)
|
||||
page.ViewRoute.Add(server)
|
||||
return page
|
||||
}
|
||||
|
||||
func createIndexTexts() {
|
||||
indexTexts = &IndexTexts{
|
||||
PageTitle: NewI18nText(map[Language]string{
|
||||
En: "Home",
|
||||
De: "Startseite",
|
||||
}),
|
||||
PageDescription: NewI18nText(map[Language]string{
|
||||
En: "Welcome to our application - Your digital solution",
|
||||
De: "Willkommen bei unserer Anwendung - Ihre digitale Lösung",
|
||||
}),
|
||||
WelcomeTitle: NewI18nText(map[Language]string{
|
||||
En: "Welcome to Your Application",
|
||||
De: "Willkommen bei Ihrer Anwendung",
|
||||
}),
|
||||
WelcomeText: NewI18nText(map[Language]string{
|
||||
En: "This is your white label template starter kit. Customize this content to match your brand and requirements.",
|
||||
De: "Dies ist Ihr White-Label-Template-Starter-Kit. Passen Sie diesen Inhalt an Ihre Marke und Anforderungen an.",
|
||||
}),
|
||||
FeaturesTitle: NewI18nText(map[Language]string{
|
||||
En: "Key Features",
|
||||
De: "Hauptfunktionen",
|
||||
}),
|
||||
FeaturesText: NewI18nText(map[Language]string{
|
||||
En: "Built with modern web technologies, responsive design, and multi-language support. Perfect foundation for your next project.",
|
||||
De: "Entwickelt mit modernen Web-Technologien, responsivem Design und mehrsprachiger Unterstützung. Perfekte Grundlage für Ihr nächstes Projekt.",
|
||||
}),
|
||||
ContactTitle: NewI18nText(map[Language]string{
|
||||
En: "Get Started",
|
||||
De: "Erste Schritte",
|
||||
}),
|
||||
ContactText: NewI18nText(map[Language]string{
|
||||
En: "Ready to customize this template? Replace this placeholder content with your own information and branding.",
|
||||
De: "Bereit, diese Vorlage anzupassen? Ersetzen Sie diesen Platzhalter-Inhalt durch Ihre eigenen Informationen und Ihr Branding.",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Page) getMetaData() PageWebsiteMetaData {
|
||||
return PageWebsiteMetaData{
|
||||
Title: indexTexts.PageTitle,
|
||||
Lang: En,
|
||||
Description: indexTexts.PageDescription,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Page) View(c HtmxContext) {
|
||||
content := IndexContent(c.GetLanguage())
|
||||
p.createPage(c, p.getMetaData(), content)
|
||||
}
|
||||
|
||||
func IndexContent(language Language) Group {
|
||||
return []Node{
|
||||
Div(Class("hero-section"),
|
||||
H1(Class("hero-title"), Text(indexTexts.WelcomeTitle.FromLang(language))),
|
||||
P(Class("hero-description"), Text(indexTexts.WelcomeText.FromLang(language))),
|
||||
),
|
||||
Div(Class("content-section"),
|
||||
H2(Class("section-title"), Text(indexTexts.FeaturesTitle.FromLang(language))),
|
||||
P(Class("section-description"), Text(indexTexts.FeaturesText.FromLang(language))),
|
||||
),
|
||||
Div(Class("content-section"),
|
||||
H2(Class("section-title"), Text(indexTexts.ContactTitle.FromLang(language))),
|
||||
P(Class("section-description"), Text(indexTexts.ContactText.FromLang(language))),
|
||||
),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user