From d6fa6b112451f10f505db886d0ed023b3b931814 Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 11 Jun 2021 09:25:18 +0200 Subject: Add CSS --- Makefile | 1 + data/css/birdscan.css | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/web.go | 5 +++ 3 files changed, 115 insertions(+) create mode 100644 data/css/birdscan.css diff --git a/Makefile b/Makefile index 3476ee2..88e4c4f 100644 --- a/Makefile +++ b/Makefile @@ -19,4 +19,5 @@ install: all install -Dm 644 systemd/birdscan.service $(DESTDIR)$(PREFIX)/lib/systemd/system/birdscan.service install -Dm 644 systemd/birdscan.sysusers $(DESTDIR)$(PREFIX)/lib/sysusers.d/birdscan.conf install -Dm 644 data/html/index.html $(DESTDIR)$(PREFIX)/share/birdscan/html/index.html + install -Dm 644 data/css/birdscan.css $(DESTDIR)$(PREFIX)/share/birdscan/css/birdscan.css diff --git a/data/css/birdscan.css b/data/css/birdscan.css new file mode 100644 index 0000000..6fe2468 --- /dev/null +++ b/data/css/birdscan.css @@ -0,0 +1,109 @@ +/* + vim: shiftwidth=2 tabstop=2 expandtab +*/ + +/* + General Stuff +*/ + +* { + box-sizing: border-box; /* Include padding and border in the element's total width and height */ +} + +body { + margin: 0; /* avoid ugly white margin */ + font-family: Arial, Helvetica, sans-serif; /* select a nice font */ +} + +nav { + background-color: black; +} + +main { + background-color: white; +} + +h1 { + text-align: center; +} + +img { + max-width: 100%; + height: auto; +} + +a { + text-decoration: none; /* disable ugly underlined links */ +} + +nav a { + color: lightgray; +} + +/* How should the link behave if the mouse is over this item? */ +nav a:hover { + background-color: lightgray; + color: black; +} + + + +/* + Default Geometry / Geometry for Phones ('Mobile First Development') +*/ + +main { + padding-left: 20px; + padding-right: 20px; + text-align: justify; +} + +main * { + display: block; +} + +nav a { + display: block; + padding: 16px; + text-align: center; +} + + + +/* + Geometry for Tablets +*/ + +@media only screen and (min-width: 600px) { + /* empty --> same rules as for phones */ +} + + + +/* + Geometry for Desktops +*/ + +@media only screen and (min-width: 768px) { + + nav { + height: 100%; + width: 200px; + position: fixed; /* position fixed in top left corner (with offset) */ + top: 0px; /* disable the offset from top left corner */ + } + + nav a { + text-align: left; + } + + main { + margin-left: 200px; /* transparent margin on the left for nav */ + } + + main * { /* everything inside the content container */ + max-width: 960px; /* maximum width on desktops should be 960 px */ + margin-left: auto; /* center it with margin */ + margin-right: auto; /* center it with margin */ + } +} diff --git a/src/web.go b/src/web.go index c0732ad..b57c5f5 100644 --- a/src/web.go +++ b/src/web.go @@ -20,6 +20,7 @@ func runServer() { router.Use(middleware.Logger) router.Get("/", indexHandler) + router.Get("/css/birdscan.css", cssHandler) log.Println("Binding to 'http://" + "127.0.0.1" + ":" + "8080" + "'") log.Fatal(http.ListenAndServe("127.0.0.1" + ":" + "8080", router)) @@ -29,3 +30,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, fmt.Sprintf("%s/html/index.html", APP_DATA)) } +func cssHandler(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, fmt.Sprintf("%s/css/birdscan.css", APP_DATA)) +} + -- cgit v1.2.3-70-g09d2