From bfbf5c42a6374f56ffd8f91242816457e4399366 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 8 Dec 2024 04:11:00 +0400 Subject: [PATCH] A templ index template was added. --- web/assets/css/main.css | 45 ++++++++----------- web/index.templ | 97 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 26 deletions(-) create mode 100644 web/index.templ diff --git a/web/assets/css/main.css b/web/assets/css/main.css index bd38180..3cdba21 100644 --- a/web/assets/css/main.css +++ b/web/assets/css/main.css @@ -11,6 +11,7 @@ --secondary-color: #9f2b68; --text-color: #f5f5f5; --text-indent: 1.6rem; + color-scheme: light dark; --overlay-background-color: #f5f5f574; scrollbar-color: var(--primary-color) var(--background-color); } @@ -77,28 +78,25 @@ header { flex-wrap: wrap; justify-content: space-between; } -header svg { width: 360px; } - header svg text { fill: var(--text-color); } header svg text:first-child { - font-size: 2rem; + font-size: 3.55rem; font-variant-caps: small-caps; font-weight: bold; } -header svg text:last-child { font-size: .88rem; } +header svg text:last-child { font-size: 1.5rem; } -@media screen and (-webkit-min-device-pixel-ratio:0) { - header svg text:first-child { font-size: 2.082rem; } } +@supports (-moz-appearance:none) { + header svg text:last-child { transform: scale(.993, 1); } } -@-moz-document url-prefix() { - header svg text:first-child { font-size: 2rem; } } +header nav { + display: flex; + flex-direction: column; + font-variant: small-caps; + justify-content: space-evenly; } -nav { margin-top: .5rem; } - -nav a { font-variant: small-caps; } - -nav h1 { +header nav h1 { color: var(--secondary-color); margin: 0; } @@ -126,6 +124,8 @@ tr:focus-within { tr:hover a, tr:focus-within a { color: white; } +tr a { color: var(--text-color); } + th { text-align: left; } th:nth-child(2), @@ -205,26 +205,19 @@ thead tr th.clickable.sort-down::after { content: '↓'; } background-color: var(--background-color); color: var(--primary-color); } -#error { - font-size: 3.5rem; - line-height: 5rem; - text-align: center; - margin: 6rem 0; } - -#error h1 { font-size: 8rem; } - footer { font-size: .8rem; text-align: center; padding: 1rem 0; } + @media screen and (max-width: 640px) { - header { display: block; } + header { + align-items: center; + flex-direction: column; } - header svg { - margin: 0 auto; - width: 100%; } + header svg { width: 100%; } - nav { + header nav { width: 100%; text-align: center; } } \ No newline at end of file diff --git a/web/index.templ b/web/index.templ new file mode 100644 index 0000000..1712682 --- /dev/null +++ b/web/index.templ @@ -0,0 +1,97 @@ +package web + +import "github.com/invopop/ctxi18n/i18n" +import "net/http" +import "dwelling-files/pkg/files" +import "dwelling-files/pkg/utils" +import "strconv" + + +templ Index(currentPath, progVer string, stat *files.DirStat, entries *[]files.DirEntry, r *http.Request) { + + + + + + + + + + Arav's dwelling / { i18n.T(ctx, "title") } + + + + + + + + + +
+ + Arav's dwelling + Welcome to my sacred place, wanderer + + +
+
+
+ @templ.Raw(currentPath) +

{ i18n.T(ctx, "stats.files") }: { strconv.FormatInt(stat.Files, 10) } ({ stat.FilesSize }); { i18n.T(ctx, "stats.directories") }: { strconv.FormatInt(stat.Directories, 10) }.

+ +
+
+ + + + + + + + + + + + + for i, entry := range *entries { + + + + + + } + +
{ i18n.T(ctx, "table.name") }{ i18n.T(ctx, "table.date") }{ i18n.T(ctx, "table.size") }
../
{ entry.Name }{ utils.ToClientTimezone(entry.Datetime, r).Format(files.FileDateFormat) }{ entry.Size }
+
+
+ @templ.Raw(currentPath) +
+ + +
+ +
+ +
+
+ +
+ +
+ + +} \ No newline at end of file