more CSS styling

This commit is contained in:
Simon Martens
2025-01-13 23:16:08 +01:00
parent 5c54b51050
commit d2c21017f0
9 changed files with 84 additions and 39 deletions

View File

@@ -14,7 +14,6 @@ var embed_cache sync.Map
// INFO: We initialize the cache in both functions, which is only valid if both of these get
// called in the same context, eg. when creating a template engine.
func EmbedSafe(fs fs.FS) func(string) template.HTML {
embed_cache.Clear()
return func(path string) template.HTML {
path = strings.TrimSpace(path)
path = filepath.Clean(path)
@@ -28,7 +27,6 @@ func EmbedSafe(fs fs.FS) func(string) template.HTML {
}
func Embed(fs fs.FS) func(string) string {
embed_cache.Clear()
return func(path string) string {
path = strings.TrimSpace(path)
path = filepath.Clean(path)
@@ -41,6 +39,10 @@ func Embed(fs fs.FS) func(string) string {
}
}
func ClearEmbedCache() {
embed_cache.Clear()
}
func getFileData(fs fs.FS, path string) ([]byte, error) {
if val, ok := embed_cache.Load(path); ok {
return val.([]byte), nil

View File

@@ -57,6 +57,7 @@ func (e *Engine) funcs() error {
e.AddFunc("Safe", functions.Safe)
// Embedding of file contents
functions.ClearEmbedCache()
e.AddFunc("EmbedSafe", functions.EmbedSafe(views.StaticFS))
e.AddFunc("Embed", functions.Embed(views.StaticFS))

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
<div>
Datenschutz, Impressum.
</div>

View File

@@ -0,0 +1,3 @@
<div class="mt-8">
<h1 class="text-4xl">Königsberger gelehrte und politische Zeitungen</h1>
</div>

View File

@@ -1,12 +1,23 @@
<nav>
<div>
<div>Übersicht nach</div>
<a href="/">Jahrgängen</a>
<a href="/akteure/a">Personen</a>
<a href="/kategorie/">Betragsarten</a>
<a href="/ort/">Orten</a>
<div class="mt-8 flex flex-row w-full">
<div class="mx-auto flex flex-row">
<div>
<input type="search" placeholder="Suche" class="px-2.5 py-1.5 border w-96" />
</div>
<div x-data="{ open: false }">
<button class="btn btn-primary" @click="open = !open">Menu</button>
<div x-show="open" class="absolute bg-slate-50">
<div>
<div>Übersicht nach</div>
<a href="/">Jahrgängen</a>
<a href="/akteure/a">Personen</a>
<a href="/kategorie/">Betragsarten</a>
<a href="/ort/">Orten</a>
</div>
<a href="/edition/">Geschichte &amp; Edition der KGPZ</a>
<a href="/zitation/">Zitation</a>
<a href="/kontakt/">Kontakt</a>
</div>
</div>
</div>
<a href="/edition/">Geschichte &amp; Edition der KGPZ</a>
<a href="/zitation/">Zitation</a>
<a href="/kontakt/">Kontakt</a>
</nav>
</div>

View File

@@ -29,16 +29,30 @@
</script>
</head>
<body class="w-full h-full p-3" hx-ext="response-targets" hx-boost="true">
{{ block "_menu" . }}
<!-- Default app menu... -->
{{ end }}
<body class="w-full" hx-ext="response-targets" hx-boost="true">
<div class="container flex flex-col min-h-screen max-w-screen-2xl mx-auto">
<header>
{{ block "_header" . }}
<!-- Default app header... -->
{{ end }}
</header>
<div>
{{ block "_menu" . }}
<!-- Default app menu... -->
{{ end }}
</div>
<main>
{{ block "body" . }}
<!-- Default app body... -->
{{ end }}
</main>
<main class="">
{{ block "body" . }}
<!-- Default app body... -->
{{ end }}
</main>
<footer>
{{ block "_footer" . }}
{{ end }}
</footer>
</div>
</body>
</html>

View File

@@ -1,23 +1,30 @@
{{ $y := .model.Year }}
<div class="yearmenu">
{{ range $year := .model.AvailableYears }}
<a href="/{{ $year }}" {{ if eq $year $y }}aria-current="page"{{ end }}>{{ $year }}</a>
{{ end }}
<div class="mt-6 w-full">
<div class="mx-auto flex flex-row gap-x-3 w-fit">
{{ range $year := .model.AvailableYears }}
<a
class="block"
href="/{{ $year }}"
{{ if eq $year $y }}aria-current="page"{{ end }}
>{{ $year }}</a
>
{{ end }}
</div>
</div>
<table class="border-spacing-y-2 border-separate">
<div class="grid grid-cols-11 gap-x-2 gap-y-4 pt-8">
{{ range $index, $month := .model.Issues }}
<tr class="">
<td class="!text-right px-8 align-top py-2">
<!-- Month Header -->
{{ $first := index $month 0 }}
<h2 class="text-lg">{{ (MonthName $first.Datum.When.Month) }}</h2>
</td>
<!-- Issues -->
<div class="col-span-1 text-right py-1 px-2.5">
<!-- Month Header -->
{{ $first := index $month 0 }}
<h2 class="text-lg">{{ (MonthName $first.Datum.When.Month) }}</h2>
</div>
<!-- Issues -->
<div class="col-span-10 grid grid-cols-subgrid">
{{ range $issue := $month }}
<td class="w-32 px-3 py-2 bg-slate-100 border-4 border-slate-50">
<div class="col-span-1 bg-slate-100 px-2 py-1.5">
{{ $date := $issue.Datum.When }}
<a class="!no-underline" href="/{{ $y }}/{{ $issue.Number.No }}">
<div>
@@ -31,8 +38,8 @@
<div class="inline-block">{{ $date.Day }}.{{ index $date.Month }}.</div>
</div>
</a>
</td>
</div>
{{ end }}
</tr>
</div>
{{ end }}
</table>
</div>

View File

@@ -40,4 +40,8 @@
.font-variant-small-caps {
font-variant-caps: small-caps;
}
main {
@apply flex-grow shrink-0;
}
}