diff options
| author | Samuel Johnson <[email protected]> | 2025-11-24 01:36:18 -0500 |
|---|---|---|
| committer | Samuel Johnson <[email protected]> | 2025-11-24 01:36:18 -0500 |
| commit | 384a590b5462883d714bc1682e4d81d6321b2b12 (patch) | |
| tree | 01d3ed55448948a2fe162b7209f0f2211770c9fb | |
| parent | 177663c73f3d708120b975a74eebd0951177a53b (diff) | |
Improve page layout, add navbar
| -rw-r--r-- | cmd/parser/main.go | 2 | ||||
| -rw-r--r-- | cmd/web/handlers/blog.go | 2 | ||||
| -rw-r--r-- | static/app.css | 86 | ||||
| -rw-r--r-- | ui/html/base.tmpl.html | 5 | ||||
| -rw-r--r-- | ui/html/pages/index.tmpl.html | 8 |
5 files changed, 99 insertions, 4 deletions
diff --git a/cmd/parser/main.go b/cmd/parser/main.go index bf79439..6d3c3c4 100644 --- a/cmd/parser/main.go +++ b/cmd/parser/main.go @@ -123,7 +123,7 @@ func main() { _, table_check := db.Query("SELECT * FROM posts;") if table_check != nil { - _, err = db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, time DATE DEFAULT CURRENT_DATE, content TEXT NOT NULL);") + _, err = db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, content TEXT NOT NULL);") if err != nil { fmt.Fprintf(os.Stderr, "Unable to create posts table: %v\n", err) os.Exit(1) diff --git a/cmd/web/handlers/blog.go b/cmd/web/handlers/blog.go index 07ab361..bd2d97f 100644 --- a/cmd/web/handlers/blog.go +++ b/cmd/web/handlers/blog.go @@ -18,6 +18,8 @@ type blogContext struct { } func (ctx *blogContext) index(w http.ResponseWriter, r *http.Request) { + ctx.Rows = []models.Post{} + if r.URL.Path != "/" { http.NotFound(w, r) return diff --git a/static/app.css b/static/app.css index a52ea8d..0148d24 100644 --- a/static/app.css +++ b/static/app.css @@ -1,3 +1,53 @@ +header { + padding: 0rem 2rem 0rem 2rem; + + display: flex; + flex-direction: row; + align-content: center; +} + +header > h1 { + padding: 0.5rem; +} + +header > nav { + margin-top: auto; + margin-bottom: auto; + margin-left: 2em; +} + +a { + margin: 0.5em; + color: inherit; + position: relative; + display: inline-block; + text-decoration: none; +} + +a::after { + content: ""; + background: white; + height: 1px; + position: absolute; + bottom: 0; + transition: .16s all 0.025s; +} + +a::after { + left: 100%; + right: 0; +} + +a:hover ~ a::after { + left: 0; + right: 100%; +} + +a:hover::after { + left: 0; + right: 0; +} + .pane { margin: auto; padding: 4px 10px; @@ -11,6 +61,42 @@ box-shadow: 0px 0px 15px 2px #410f5e; } +.topline { + display: flex; + flex-direction: row; + justify-content: center; + align-content: center; +} + +.topline > p { + margin-top: auto; + margin-bottom: auto; + margin-left: 2em; +} + +.card { + border-top: 1px solid #fff; + + padding-top: 0.5rem; + padding-bottom: 0.75rem; + padding-left: 2rem; + padding-right: 2rem; + + margin: 0.25rem; + margin-bottom: 1rem; + + border-radius: 20px; + transition: box-shadow 0.2s ease-in-out; +} + +.card:hover { + box-shadow: 0px 0px 15px 2px #ecb77d; +} + +.card .header { + text-align: center; +} + #bg-image { position: fixed; diff --git a/ui/html/base.tmpl.html b/ui/html/base.tmpl.html index fe33ec4..dda949b 100644 --- a/ui/html/base.tmpl.html +++ b/ui/html/base.tmpl.html @@ -17,6 +17,11 @@ <div class="pane"> <header> <h1>Paterissa</h1> + <nav> + <a href="https://git.paterissa.net">Git</a> + <a href="https://starless.paterissa.net">Starless</a> + <a href="https://charts.paterissa.net">Parliament Builder</a> + </nav> </header> <hr> <main class="inner_pane"> diff --git a/ui/html/pages/index.tmpl.html b/ui/html/pages/index.tmpl.html index ec98623..78c2bb2 100644 --- a/ui/html/pages/index.tmpl.html +++ b/ui/html/pages/index.tmpl.html @@ -1,14 +1,16 @@ {{define "title"}}Blog{{end}} {{define "main"}} - <h2>Blog</h2> - <p>Home of {{.Name}}</p> + <div class="topline"> + <h2>Blog</h2> + <p>Home of {{.Name}}</p> + </div> {{range .Rows}} <div class="card"> <div class="header"> <h4><b>{{.Name}} - {{.Time}}</b></h4> - {{.Content}} </div> + {{.Content}} </div> {{end}} {{end}} |
