mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-05 06:43:21 +00:00
dark mode at root fixes #75
This commit is contained in:
parent
65c7d98b5a
commit
0508b95e24
|
@ -327,6 +327,11 @@ func Render(w http.ResponseWriter, templateName string, state State) {
|
||||||
func GetRoot(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
func GetRoot(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
data := make(map[string]any)
|
data := make(map[string]any)
|
||||||
data["Title"] = r.Host
|
data["Title"] = r.Host
|
||||||
|
if dark := getCookie(r, "Dark"); dark != "" {
|
||||||
|
data["Dark"] = dark != "0"
|
||||||
|
} else {
|
||||||
|
data["Dark"] = os.Getenv("DARK") != ""
|
||||||
|
}
|
||||||
tmpl, err := GetTemplate("root.html")
|
tmpl, err := GetTemplate("root.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("execute fail", err)
|
fmt.Println("execute fail", err)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<link rel="stylesheet" href="/_/static/style.css?v=7">
|
<link rel="stylesheet" href="/_/static/style.css?v=7">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body{{ if .Dark }} class="dark"{{end}}>
|
||||||
<nav>
|
<nav>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<span class="title">{{ .Title }}</span>
|
<span class="title">{{ .Title }}</span>
|
||||||
|
|
Loading…
Reference in a new issue