Compare commits

...

2 Commits

Author SHA1 Message Date
Jill 57b87d318c polish 2022-05-04 01:34:53 +03:00
Jill 734dcca462 woo footer 2022-05-04 01:08:28 +03:00
13 changed files with 130 additions and 27 deletions

View File

@ -19,15 +19,6 @@ body {
padding: 0; padding: 0;
} }
main {
max-width: 1200px;
margin: 0 auto;
margin-bottom: 100px;
display: flex;
flex-direction: column;
align-items: center;
}
code, pre { code, pre {
font-family: var(--font-monospace); font-family: var(--font-monospace);
} }
@ -47,4 +38,19 @@ a:hover {
background-color: rgb(30,31,31); background-color: rgb(30,31,31);
color: #eee; color: #eee;
} }
}
html, body {
height: 100%;
}
body {
display: flex;
flex-direction: column;
align-items: center;
}
body > main {
flex: 1 0 auto;
}
body > footer {
flex-shrink: 0;
} }

View File

@ -8,6 +8,6 @@
%svelte.head% %svelte.head%
</head> </head>
<body> <body>
<div>%svelte.body%</div> %svelte.body%
</body> </body>
</html> </html>

34
src/lib/Footer.svelte Normal file
View File

@ -0,0 +1,34 @@
<style>
.footer {
background-color: rgb(220, 226, 221);
padding: 2em;
font-size: small;
color: #555;
}
a {
color: #444;
}
a:hover {
color: #222;
}
@media (prefers-color-scheme: dark) {
.footer {
background-color: rgb(20, 21, 21);
color: #888;
}
a {
color: #aaa;
}
a:hover {
color: #ccc;
}
}
</style>
<div class="footer">
<a href="https://git.oat.zone/oat/guidebook" target="_blank"><b>Guidebook</b></a> is maintained by <b>Jill "oatmealine" Monoids</b> and is licensed under <a href="https://git.oat.zone/oat/guidebook/src/branch/main/LICENSE" target="_blank"><b>GPL-3.0</b></a>.
</div>

View File

@ -7,7 +7,7 @@
width: calc(100%); width: calc(100%);
padding: 0; padding: 0;
margin: 0; margin: 0;
box-shadow: 0px 2px 15px rgba(10, 10, 10, 0.4); box-shadow: 0px 2px 8px rgba(10, 10, 10, 0.2);
background-color: rgb(140, 241, 100); background-color: rgb(140, 241, 100);
color: rgb(30,31,31); color: rgb(30,31,31);
font-weight: 600; font-weight: 600;

View File

@ -1,9 +1,9 @@
<script> <script>
import Markdown from 'svelte-exmarkdown'; import Markdown from 'svelte-exmarkdown';
import { gfmPlugin } from 'svelte-exmarkdown/gfm'; import { gfmPlugin } from 'svelte-exmarkdown/gfm';
import Code from './Code.svelte'; import Code from './markdown/Code.svelte';
import Link from './Link.svelte'; import Link from './markdown/Link.svelte';
import Section from './Section.svelte'; import Section from './markdown/Section.svelte';
const highlightPlugin = { const highlightPlugin = {
renderer: { renderer: {

View File

@ -18,7 +18,7 @@
</style> </style>
<!-- svelte-ignore a11y-missing-attribute --> <!-- svelte-ignore a11y-missing-attribute -->
<a {...properties} {target}> <a {...properties} {target} rel={isExternal ? 'nofollow noreferrer external' : ''}>
<Children {children} /> <Children {children} />
{#if isExternal} {#if isExternal}
<span class="icon"> <span class="icon">

View File

@ -1,6 +1,6 @@
<script> <script>
import Children from 'svelte-exmarkdown/renderer/Children.svelte'; import Children from 'svelte-exmarkdown/renderer/Children.svelte';
import { toAnchor } from './anchors'; import { toAnchor } from '$lib/anchors';
export let children; export let children;
export let properties; export let properties;

View File

@ -4,6 +4,7 @@
import themeDark from 'svelte-highlight/styles/apprentice'; import themeDark from 'svelte-highlight/styles/apprentice';
import themeLight from 'svelte-highlight/styles/atelier-forest-light'; import themeLight from 'svelte-highlight/styles/atelier-forest-light';
import Header from '$lib/Header.svelte'; import Header from '$lib/Header.svelte';
import Footer from '$lib/Footer.svelte';
let theme = `<style> let theme = `<style>
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
@ -20,9 +21,31 @@ ${themeDark.slice(7, -7)}
{@html theme} {@html theme}
</svelte:head> </svelte:head>
<header> <style>
<Header/> main {
</header> width: 100%;
}
.content {
max-width: 1200px;
margin: 0 auto;
margin-bottom: 100px;
display: flex;
flex-direction: column;
align-items: center;
}
footer {
width: 100%;
}
</style>
<main> <main>
<slot></slot> <header>
</main> <Header/>
</header>
<div class="content">
<slot></slot>
</div>
</main>
<footer>
<Footer/>
</footer>

View File

@ -10,6 +10,10 @@
} }
</style> </style>
<svelte:head>
<title>Guidebook</title>
</svelte:head>
<div class="shortdesc"> <div class="shortdesc">
<Page content= <Page content=
{` {`

View File

@ -2,18 +2,19 @@ import { getPost, getPostsFlat, isDir } from "$lib/pages";
export async function get({ params }) { export async function get({ params }) {
let dir = await isDir(params.name); let dir = await isDir(params.name);
let split = params.name.split('/');
if (dir === null) { if (dir === null) {
return {status: 404}; return {status: 404};
} else if (dir) { } else if (dir) {
return { return {
body: { body: {
pages: await getPostsFlat(params.name) pages: await getPostsFlat(params.name),
loc: split[split.length - 1]
} }
} }
} else { } else {
let pages = []; let pages = [];
let split = params.name.split('/');
if (split.length > 1) { if (split.length > 1) {
pages = await getPostsFlat(split[split.length - 2]); pages = await getPostsFlat(split[split.length - 2]);
} }
@ -25,7 +26,8 @@ export async function get({ params }) {
return { return {
body: { body: {
page: post, page: post,
pages: pages pages: pages,
loc: split[split.length - 2]
} }
} }
} }

View File

@ -3,11 +3,22 @@
import PageRenderer from './_page.svelte'; import PageRenderer from './_page.svelte';
export let page; export let page;
export let pages; export let pages;
export let loc;
</script> </script>
{#if page} {#if page}
<PageRenderer {page} {pages}/> <PageRenderer {page} {pages} {loc}/>
{:else if pages} {:else if pages}
<style>
.pagesin {
font-size: 1.5em;
margin-top: 1em;
margin-bottom: 1em;
}
</style>
<div class="pagesin">Pages in <b>{loc}</b>:</div>
<Pages {pages}/> <Pages {pages}/>
{:else} {:else}
404! 404!

View File

@ -4,6 +4,7 @@
import Pages from "$lib/Pages.svelte"; import Pages from "$lib/Pages.svelte";
export let page; export let page;
export let pages; export let pages;
export let loc;
</script> </script>
<style> <style>
@ -11,6 +12,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 1em; gap: 1em;
max-width: 100%;
} }
.side { .side {
min-width: 120px; min-width: 120px;
@ -29,6 +31,24 @@
padding: 8px; padding: 8px;
min-width: 0; min-width: 0;
} }
.other {
color: #888;
margin-top: 2em;
max-width: 90%;
padding-left: 4em;
padding-right: 4em;
text-align: center;
padding-bottom: 1em;
margin-bottom: 1em;
border-bottom: 1px solid #888;
}
.viewall {
margin-top: 2em;
font-size: 0.9em;
color: #bbb;
}
@media screen and (max-width: 1300px) { @media screen and (max-width: 1300px) {
.side { .side {
display: none; display: none;
@ -80,10 +100,13 @@
</nav> </nav>
</div> </div>
<content> <content>
<Page content={page.content}></Page> <Page content={page.content}/>
</content> </content>
</div> </div>
{#if pages} {#if pages && pages.length > 0}
<div class="other">Other pages in this category:</div>
<br>
<Pages pages={pages.slice(0, 3)}/> <Pages pages={pages.slice(0, 3)}/>
<a class="viewall" href="/p/{page.path.split('/').slice(0, -1).join('/') + '/'}">View all pages in <b>{loc}</b></a>
{/if} {/if}