From 4fa6f1621b406ce58b91a4ae9a58b392d78b7008 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Tue, 28 Jun 2022 02:02:17 +0900 Subject: Abstract template and style --- static/archive.css | 4 ---- static/base.css | 12 ++++++++++++ static/directory.css | 12 ++++++++++++ templates/archive.html | 5 +---- templates/base-head.html | 5 +++++ templates/directory.html | 10 ++++------ 6 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 static/base.css create mode 100644 static/directory.css create mode 100644 templates/base-head.html diff --git a/static/archive.css b/static/archive.css index 7bd1c47..628461e 100644 --- a/static/archive.css +++ b/static/archive.css @@ -1,5 +1,3 @@ -body { margin: 0 } - nav { display: flex; justify-content: space-around; @@ -7,10 +5,8 @@ nav { top: 0; } nav > a { - color: white; flex: 1; text-align: center; - text-decoration: none; } nav > a:hover { font-weight: bold } #prev { background-color: #a40000 } diff --git a/static/base.css b/static/base.css new file mode 100644 index 0000000..549ac8f --- /dev/null +++ b/static/base.css @@ -0,0 +1,12 @@ +html { + background-color: black; + font-size: min(max(100%, 2vw), 150%); + margin: auto; +} + +body { margin: 0 } + +a { + color: white; + text-decoration: none; +} diff --git a/static/directory.css b/static/directory.css new file mode 100644 index 0000000..b56cd6e --- /dev/null +++ b/static/directory.css @@ -0,0 +1,12 @@ +main { + margin: auto; + max-width: 25rem; +} + +p { + margin: 0; + padding: 1ex; +} + +a:nth-child(2n) p { background-color: #5c3566 } +a:hover { text-decoration: underline } diff --git a/templates/archive.html b/templates/archive.html index 3b20ae9..fbd2f7a 100644 --- a/templates/archive.html +++ b/templates/archive.html @@ -1,7 +1,4 @@ - - - - +{{template "base-head.html" -}} {{.Title}} diff --git a/templates/base-head.html b/templates/base-head.html new file mode 100644 index 0000000..ebb981c --- /dev/null +++ b/templates/base-head.html @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/directory.html b/templates/directory.html index c89d388..6fc35fa 100644 --- a/templates/directory.html +++ b/templates/directory.html @@ -1,12 +1,10 @@ - - - - +{{template "base-head.html" -}} + {{.Title}}
-

../

{{range .Entries}} -

{{.}}

{{end}} +

../

{{range .Entries}} +

{{.}}

{{end}}
-- cgit 1.4.1