diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/static/img/icons/book.png | bin | 0 -> 754 bytes | |||
| -rw-r--r-- | public/static/style.css | 130 | ||||
| -rw-r--r-- | public/wiki.php | 66 |
3 files changed, 196 insertions, 0 deletions
diff --git a/public/static/img/icons/book.png b/public/static/img/icons/book.png Binary files differnew file mode 100644 index 0000000..5084b14 --- /dev/null +++ b/public/static/img/icons/book.png diff --git a/public/static/style.css b/public/static/style.css index a39a3bd..739e76c 100644 --- a/public/static/style.css +++ b/public/static/style.css @@ -9,6 +9,9 @@ --promo-button-background-hover: #ff9028; --promo-button-foreground: #662000; --promo-button-border: #ac6019; + + --wiki-content-background: #fff; + --wiki-sidebar-background: #fefefe; } * { @@ -189,6 +192,129 @@ button:hover { } /** +--- WIKI +*/ + +.wiki-sidebar { + display: flex; + flex-direction: column; + position: sticky; + top: 0; + min-width: 256px; + max-height: 100vh; + + overflow-y: scroll; + + background: var(--wiki-sidebar-background); + + padding: 8px; + + font-size: 16px; + gap: 6px; + + box-shadow: 2px 0 1px rgba(0, 0, 0, 0.25); +} + +.wiki-sidebar h1 { + font-size: 20px; + font-weight: 600; +} + +.wiki-sidebar h2 { + font-size: 18px; + font-weight: 600; + margin-left: 4px; +} + +.wiki-sidebar h1, +.wiki-sidebar h2 { + margin-top: 4px; + margin-bottom: 4px; +} + +.wiki-sidebar ul { + list-style: none; + margin: 0 8px; +} + +.wiki-sidebar a { + color: rgb(4, 120, 87); + text-decoration: underline; +} + +.wiki-sidebar a:hover { + color: rgb(16, 185, 129); +} + + +div:has(.wiki-content) { + background: var(--wiki-content-background); +} + +.wiki-content { + margin: 0 16px; + margin-bottom: 64px; +} + +.wiki-content h1 { + font-size: 32px; + font-weight: 600; +} + +.wiki-content h2 { + font-size: 24px; + font-weight: 600; +} + +.wiki-content h3 { + font-size: 18px; +} + +.wiki-content h1, +.wiki-content h2, +.wiki-content h3, +.wiki-content h4 { + margin: 16px 0; +} + +.wiki-content p { + margin: 16px 16px; +} + +.wiki-content ul { + margin: 0 32px; +} + +.wiki-content li { + list-style-type: disc; +} + +.wiki-content a { + color: rgb(4, 120, 87); + text-decoration: underline; +} + +.wiki-content a:hover { + color: rgb(16, 185, 129); +} + +.wiki-content code { + background-color: rgba(243, 244, 246, 255); + color: rgba(5, 150, 105, 255); + padding: 2px; + border-radius: 2px; +} + +.wiki-content blockquote { + background-color: rgba(243, 244, 246, 255); + padding: 2px; + margin: 16px 0; + + border-left-width: 4px; + border-color: rgba(5, 150, 105, 255); +} + +/** --- SHORTCUTS */ @@ -255,6 +381,10 @@ button:hover { padding: 16px; } +.p-4 { + padding: 4px; +} + .border { border: 0.25px solid rgba(133, 133, 133, 0.25); }
\ No newline at end of file diff --git a/public/wiki.php b/public/wiki.php new file mode 100644 index 0000000..4cb1189 --- /dev/null +++ b/public/wiki.php @@ -0,0 +1,66 @@ +<?php +include_once $_SERVER['DOCUMENT_ROOT'] . '/../lib/partials.php'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/../vendor/autoload.php'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/../config.php'; + +$page_id = $_GET['p'] ?? 'README'; +$page_name = "$page_id.md"; + +$iter = new RecursiveDirectoryIterator(WIKI_PAGE_DIRECTORY); +$page_path = null; +foreach (new RecursiveIteratorIterator($iter) as $filename => $cur) { + if (basename($filename) == $page_name) { + $page_path = $filename; + break; + } +} + +if (!isset($page_path) || !is_file($page_path)) { + http_response_code(404); + exit; +} + +$parsedown = new Parsedown(); +$contents = $parsedown->parse(file_get_contents($page_path)); + +if ($sidebar = file_get_contents(WIKI_PAGE_DIRECTORY . '/summary.md')) { + $sidebar = $parsedown->parse($sidebar); +} +?> +<html> + +<head> + <title><?= $page_id ?> - Wiki - The Tinybot Project</title> + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> + <link rel="stylesheet" href="/static/style.css"> + <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon"> +</head> + +<body> + <main> + <?php html_navigation_bar() ?> + <content> + <div class="row gap-8 background-colorful p-4" style="box-shadow: 0 2px 1px rgba(0, 0, 0, 0.25);z-index:1;"> + <img src="/static/img/icons/book.png" alt=""> + <h2>Wiki</h2> + </div> + <div class="row"> + <?php if (isset($sidebar)): ?> + <!-- SIDE BAR --> + <div class="wiki-sidebar"> + <?= $sidebar ?> + </div> + <?php endif; ?> + + <!-- WIKI CONTENT --> + <div class="wiki-content"> + <?= $contents ?> + </div> + </div> + </content> + </main> + + <?php html_footer() ?> +</body> + +</html>
\ No newline at end of file |
