2024-04-13 11:50:05 -07:00
|
|
|
package home
|
|
|
|
|
|
|
|
import "templ-test/views/layout"
|
2024-04-14 18:39:04 -07:00
|
|
|
import "templ-test/views/components/bootstrap"
|
|
|
|
import "templ-test/models"
|
|
|
|
import "templ-test/domain"
|
2024-04-13 11:50:05 -07:00
|
|
|
|
2024-04-14 18:39:04 -07:00
|
|
|
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>
|
2024-04-13 11:50:05 -07:00
|
|
|
}
|
|
|
|
}
|
2024-04-14 18:39:04 -07:00
|
|
|
|
|
|
|
func useDarkMode(value string) bool {
|
|
|
|
if value == "on" {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|