Add footer
This commit is contained in:
parent
87933747e3
commit
9c4fb07f91
@ -5,6 +5,7 @@ import { tempstreamAsync } from "tempstream";
|
|||||||
import { DEFAULT_HTML_LANG } from "./config.js";
|
import { DEFAULT_HTML_LANG } from "./config.js";
|
||||||
import { defaultHead } from "./defaultHead.js";
|
import { defaultHead } from "./defaultHead.js";
|
||||||
import { default_navbar } from "./routes/common/navbar.js";
|
import { default_navbar } from "./routes/common/navbar.js";
|
||||||
|
import footer from "./routes/common/footer.js";
|
||||||
|
|
||||||
const default_html_options: Partial<HTMLOptions> = {
|
const default_html_options: Partial<HTMLOptions> = {
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
@ -64,7 +65,7 @@ export default function html({
|
|||||||
${classes ? `class="${classes}"` : ""}
|
${classes ? `class="${classes}"` : ""}
|
||||||
>
|
>
|
||||||
${!hideNavigation ? (htmlOptions?.navbar || default_navbar)(ctx) : ""}
|
${!hideNavigation ? (htmlOptions?.navbar || default_navbar)(ctx) : ""}
|
||||||
${body}
|
${body} ${footer(ctx)}
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
}
|
}
|
||||||
|
|||||||
44
src/back/routes/common/footer.css
Normal file
44
src/back/routes/common/footer.css
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
footer {
|
||||||
|
background-color: var(--color-brand-accent2);
|
||||||
|
color: var(--color-brand-text-on-accent2);
|
||||||
|
grid-column: screen !important;
|
||||||
|
align-self: end;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: subgrid;
|
||||||
|
padding: 16px 0;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
grid-column: content;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
li {
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--color-brand-text-on-accent2);
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 16px 8px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer__attribution {
|
||||||
|
text-align: center;
|
||||||
|
align-self: end;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/back/routes/common/footer.tsx
Normal file
31
src/back/routes/common/footer.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import type { Context } from "koa";
|
||||||
|
import { TempstreamJSX } from "tempstream";
|
||||||
|
|
||||||
|
export default async function footer(ctx: Context) {
|
||||||
|
const { items: navbar_items } = await ctx.$app.collections["navbar-links"]
|
||||||
|
.list(ctx.$context)
|
||||||
|
.fetch();
|
||||||
|
const linkData = navbar_items.map((e) => ({
|
||||||
|
text: e.get("label"),
|
||||||
|
url: e.get("href"),
|
||||||
|
}));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<footer>
|
||||||
|
<ul class="footer__navlinks">
|
||||||
|
<li>
|
||||||
|
<a href="/">{ctx.$app.manifest.name}</a>
|
||||||
|
</li>
|
||||||
|
{linkData.map((link) => (
|
||||||
|
<li>
|
||||||
|
<a href={link.url}>{link.text}</a>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
<div class="footer__attribution">
|
||||||
|
Implented using open technologies from{" "}
|
||||||
|
<a href="https://www.sealcode.it/">Sealcode</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -6,6 +6,12 @@ html {
|
|||||||
background: var(--color-brand-canvas);
|
background: var(--color-brand-canvas);
|
||||||
font-family: var(--font-sans-serif);
|
font-family: var(--font-sans-serif);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
container-type: inline-size;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
grid-auto-rows: min-content min-content min-content auto;
|
||||||
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-layout-main {
|
.grid-layout-main {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user