go-cook-portal/views/home/settings.templ

33 lines
862 B
Plaintext
Raw Permalink Normal View History

package home
import "templ-test/views/layout"
import "templ-test/views/components/bootstrap"
import "templ-test/models"
import "templ-test/domain"
const (
test = "t"
)
templ UserSettings(model models.SettingsViewModel) {
@layout.WithLayout("Settings") {
<form hx-post="/settings">
<div class="mb-3">
if useDarkMode(model.DarkMode) {
@bootstrap.Switch("darkmode", bootstrap.SwitchTypeCheckbox, test, true)
} else {
@bootstrap.Switch("darkmode", bootstrap.SwitchTypeCheckbox, "flexSwitchCheckDefault", true)
}
@bootstrap.Label("form-check-label", domain.CookieSettingsDarkMode, "flexSwitchCheckDefault", "Use Dark Mode")
</div>
@bootstrap.BootstrapButton("Submit", bootstrap.VariantInfo, bootstrap.ButtonTypeSubmit)
</form>
}
}
func useDarkMode(value string) bool {
if value == "on" {
return true
}
return false
}