187 lines
4.6 KiB
Plaintext
187 lines
4.6 KiB
Plaintext
---
|
|
import Layout from "./Layout.astro";
|
|
import { Icon } from "astro-icon";
|
|
|
|
interface Props {
|
|
title: string;
|
|
slug: string;
|
|
published?: Date;
|
|
srcPath?: string;
|
|
moreLinks?: {
|
|
icon: string;
|
|
href: string;
|
|
}[];
|
|
}
|
|
|
|
const { title, srcPath, published, moreLinks, slug } = Astro.props;
|
|
const gitUrl = `https://git.c0ntroller.de/c0ntroller/frontpage/src/branch/dev/src/content/${srcPath}`
|
|
---
|
|
|
|
<Layout title={title} showAfterMain={Astro.slots.has("footer-nav")} mainTransitionName={`markdown-border-${slug}`}>
|
|
{Astro.slots.has("main-nav") ?
|
|
<slot name="main-nav" /> :
|
|
null}
|
|
|
|
{ moreLinks && moreLinks.length !== 0 ?
|
|
<div class="more">
|
|
{ moreLinks.map(l => <a href={l.href} referrerpolicy="no-referrer" class="nostyle" style={{ display: "inline-block", width: "2em" }}><Icon name={l.icon} /></a>) }
|
|
</div>
|
|
: null}
|
|
<h1 transition:name={`markdown-title-${slug}`}>{title}</h1>
|
|
<slot />
|
|
{ published || srcPath ? <>
|
|
<hr />
|
|
<div class="contentFooter">
|
|
{ published ? <>Published on: <time datetime={published.toISOString()}>{published.toLocaleDateString("en-GB", {day: "2-digit", month: "long", year: "numeric", hour: "2-digit", minute: "2-digit", timeZone: "Europe/Berlin", hour12: false})}</time></> : null }
|
|
{ published && srcPath ? <> | </> : null}
|
|
{ srcPath ? <a href={gitUrl}>Document source</a> : null }
|
|
</div>
|
|
|
|
</>: null }
|
|
{Astro.slots.has("footer-nav") ?
|
|
<slot name="footer-nav" slot="after-main" /> :
|
|
null}
|
|
</Layout>
|
|
|
|
<style lang="scss" is:global>
|
|
main {
|
|
.contentFooter {
|
|
background-color: var(--blog_background-main);
|
|
clear: right;
|
|
border-radius: 1em;
|
|
margin-top: 10px;
|
|
padding: 14px 16px;
|
|
margin-bottom: -40px;
|
|
|
|
@media screen and (max-width: 890px) {
|
|
& {
|
|
margin-bottom: -10px;
|
|
}
|
|
}
|
|
}
|
|
|
|
h1 + p:first-of-type {
|
|
font-style: italic;
|
|
font-size: 120%;
|
|
}
|
|
|
|
tbody > tr:nth-of-type(odd) {
|
|
background-color: var(--blog_background-main);
|
|
}
|
|
|
|
tbody > tr:hover {
|
|
background-color: rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
pre {
|
|
background-color: #282c34;
|
|
border: 1px solid var(--blog_content-border);
|
|
padding: 1em;
|
|
color: #abb2bf;
|
|
clear: right;
|
|
}
|
|
|
|
:not(pre) > code,
|
|
kbd {
|
|
background-color: var(--blog_background-main);
|
|
color: inherit;
|
|
|
|
[data-theme="light"] & {
|
|
background-color: #d49a9a;
|
|
}
|
|
}
|
|
|
|
kbd {
|
|
border-radius: 3px;
|
|
border: 1px solid #b4b4b4;
|
|
box-shadow:
|
|
0 1px 1px rgba(0, 0, 0, 0.2),
|
|
0 2px 0 0 rgba(255, 255, 255, 0.7) inset;
|
|
display: inline-block;
|
|
font-size: 0.85em;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
padding: 2px 4px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
a:link,
|
|
a:visited,
|
|
a:active {
|
|
color: var(--blog_color-accent);
|
|
text-decoration: none;
|
|
}
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
img {
|
|
width: 80%;
|
|
height: auto;
|
|
}
|
|
|
|
blockquote {
|
|
background: rgba(0, 0, 0, 0.2);
|
|
border-left: 3px solid var(--blog_content-border);
|
|
padding: .7em 1em;
|
|
margin-left: 1em;
|
|
|
|
p {
|
|
margin: 0;
|
|
}
|
|
}
|
|
|
|
/* A custom indicator that this code is in fact faulty */
|
|
.notCompiling code {
|
|
display: block;
|
|
position: relative;
|
|
/*
|
|
.content {
|
|
position: absolute;
|
|
}*/
|
|
|
|
&::before {
|
|
content: "!";
|
|
color: white;
|
|
background-color: #a30e0e;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
top: 1em;
|
|
right: 1em;
|
|
display: inline-block;
|
|
width: 1.3em;
|
|
height: 1.3em;
|
|
text-align: center;
|
|
font-weight: bolder;
|
|
padding: 1px 1px 1px 1px;
|
|
font-family: sans-serif;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
&:hover::after {
|
|
content: "Code is faulty!";
|
|
font-weight: bold;
|
|
color: #a30e0e;
|
|
position: absolute;
|
|
right: 1em;
|
|
bottom: 1em;
|
|
}
|
|
}
|
|
}
|
|
|
|
.more {
|
|
float: right;
|
|
|
|
@media screen and (max-width: 890px) {
|
|
& {
|
|
float: none;
|
|
display: block;
|
|
width: max-content;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
</style> |