diff options
Diffstat (limited to 'api/handlers/html.go')
| -rw-r--r-- | api/handlers/html.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/api/handlers/html.go b/api/handlers/html.go index dd5d4e8..2f6688c 100644 --- a/api/handlers/html.go +++ b/api/handlers/html.go @@ -7,6 +7,28 @@ import ( "git.leonardobishop.net/history/pkg/html" ) +const style = `<style> +.entry { + display: grid; + grid-template: + 'title date' + 'desc desc'; +} + +.entry-title { + grid-area: title; +} + +.entry-date { + grid-area: date; + justify-self: end; +} + +.entry-description { + grid-area: desc; +} +</style>` + func GetEntriesHtml(entriesService entries.Service, htmlService html.Service) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { entries, err := entriesService.GetEntries() @@ -21,6 +43,20 @@ func GetEntriesHtml(entriesService entries.Service, htmlService html.Service) ht return } + if r.URL.Query().Get("css") == "no" { + goto send + } + + html = `<!DOCTYPE html> +<html> +<head> +<title>History</title> +` + style + ` +</head> +<body>` + html + `</body> +</html>` + + send: w.Header().Set("Content-Type", "text/html;charset=UTF-8") w.Write([]byte(html)) } |
