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 // 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. // called in the same context, eg. when creating a template engine.
func EmbedSafe(fs fs.FS) func(string) template.HTML { func EmbedSafe(fs fs.FS) func(string) template.HTML {
embed_cache.Clear()
return func(path string) template.HTML { return func(path string) template.HTML {
path = strings.TrimSpace(path) path = strings.TrimSpace(path)
path = filepath.Clean(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 { func Embed(fs fs.FS) func(string) string {
embed_cache.Clear()
return func(path string) string { return func(path string) string {
path = strings.TrimSpace(path) path = strings.TrimSpace(path)
path = filepath.Clean(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) { func getFileData(fs fs.FS, path string) ([]byte, error) {
if val, ok := embed_cache.Load(path); ok { if val, ok := embed_cache.Load(path); ok {
return val.([]byte), nil return val.([]byte), nil

View File

@@ -57,6 +57,7 @@ func (e *Engine) funcs() error {
e.AddFunc("Safe", functions.Safe) e.AddFunc("Safe", functions.Safe)
// Embedding of file contents // Embedding of file contents
functions.ClearEmbedCache()
e.AddFunc("EmbedSafe", functions.EmbedSafe(views.StaticFS)) e.AddFunc("EmbedSafe", functions.EmbedSafe(views.StaticFS))
e.AddFunc("Embed", functions.Embed(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 class="mt-8 flex flex-row w-full">
<div> <div class="mx-auto flex flex-row">
<div>Übersicht nach</div> <div>
<a href="/">Jahrgängen</a> <input type="search" placeholder="Suche" class="px-2.5 py-1.5 border w-96" />
<a href="/akteure/a">Personen</a> </div>
<a href="/kategorie/">Betragsarten</a>
<a href="/ort/">Orten</a> <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> </div>
<a href="/edition/">Geschichte &amp; Edition der KGPZ</a> </div>
<a href="/zitation/">Zitation</a>
<a href="/kontakt/">Kontakt</a>
</nav>

View File

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

View File

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

View File

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