From bfd24e0dc7826241f136af5699e677e747c1b03f Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Tue, 15 Oct 2024 01:03:39 -0300 Subject: [PATCH] feat(layouts): base layout for all pages --- configs/info.go | 6 ++++ templates/layouts/page.templ | 55 ++++++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 configs/info.go diff --git a/configs/info.go b/configs/info.go new file mode 100644 index 0000000..8bf7521 --- /dev/null +++ b/configs/info.go @@ -0,0 +1,6 @@ +package configs + +const ( + APP_NAME = "Comicverse" + APP_VERSION = "0.0.0" +) diff --git a/templates/layouts/page.templ b/templates/layouts/page.templ index d30aeb4..c05b248 100644 --- a/templates/layouts/page.templ +++ b/templates/layouts/page.templ @@ -1,9 +1,58 @@ package layouts -templ Page() { - +import ( + "forge.capytal.company/capytalcode/project-comicverse/configs" +) + +type PageInfo struct { + Title string + Description string + Author string + Keywords string + ThemeColor string + Heading templ.Component +} + +func pageInfo(info []PageInfo) PageInfo { + if len(info) != 0 { + return info[0] + } + return PageInfo{} +} + +templ Page(i ...PageInfo) { + - + // Page information + if pageInfo(i).Title != "" { + { pageInfo(i).Title + " - " + configs.APP_NAME } + } else { + Comicverse + } + if pageInfo(i).Author != "" { + + } else { + + } + if pageInfo(i).Description != "" { + + } + + // Page configuration + + + + if pageInfo(i).ThemeColor != "" { + + } + // Global styles + + // Global scripts + + // Additional heading + if pageInfo(i).Heading != nil { + @pageInfo(i).Heading + } { children... }