diff --git a/views/home/error.templ b/views/home/error.templ
index 7ca9230..f92a3b9 100644
--- a/views/home/error.templ
+++ b/views/home/error.templ
@@ -3,7 +3,7 @@ package home
import "templ-test/views/layout"
templ Error(message error) {
- @layout.Testing("Error") {
+ @layout.WithLayout("Error") {
Oops... :(
{ message.Error() }
}
diff --git a/views/home/home.templ b/views/home/home.templ
index 0a1add7..e6e9f74 100644
--- a/views/home/home.templ
+++ b/views/home/home.templ
@@ -4,14 +4,14 @@ import "templ-test/views/components/bootstrap"
import "templ-test/views/layout"
templ Home() {
- @layout.WithLayout("Home", true) {
+ @layout.WithLayout("Home") {
this should be above the alert
@bootstrap.BootstrapAlert("Testing!", bootstrap.VariantDark)
you should now see this under the Alert
- @bootstrap.BootstrapButton("I am in danger", bootstrap.VariantDanger)
- @bootstrap.BootstrapButton("I am the darkness", bootstrap.VariantDark)
+ @bootstrap.BootstrapButton("I am in danger", bootstrap.VariantDanger, bootstrap.ButtonTypeDefault)
+ @bootstrap.BootstrapButton("I am the darkness", bootstrap.VariantDark, bootstrap.ButtonTypeDefault)
}
}
diff --git a/views/layout/body.templ b/views/layout/body.templ
index a626b65..f4eb6e0 100644
--- a/views/layout/body.templ
+++ b/views/layout/body.templ
@@ -1,6 +1,6 @@
package layout
-templ WithLayout(pageName string, useDarkMode bool) {
+templ WithLayout(pageName string) {
@getHtmlHead()
diff --git a/views/layout/util.go b/views/layout/util.go
index ea4ec80..78351cd 100644
--- a/views/layout/util.go
+++ b/views/layout/util.go
@@ -2,8 +2,14 @@ package layout
import (
"context"
+ "templ-test/domain"
)
func useLightOrDarkTheme(ctx context.Context) string {
- return "dark"
+ cookie := ctx.Value(domain.CookieSettingsDarkMode)
+ if cookie == "on" {
+ return "dark"
+ } else {
+ return "light"
+ }
}