From a7c1752047af9cb991f2d2112729ccf32a14fb8d Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 8 Mar 2023 00:43:58 +0000 Subject: [PATCH] WIP stuff. --- public/assets/2022.css | 12 --- public/assets/makai22.css | 156 ++++++++++++++++++++++++++++++++++++++ public/assets/makai22.js | 0 public/index.php | 10 +++ src/Template.php | 1 + src/TemplateContext.php | 14 ++-- tpl/_layout/copy22.php | 4 + tpl/_layout/header22.php | 22 ++++++ tpl/_layout/sidebar22.php | 0 tpl/index22.php | 26 +++++++ tpl/master22.php | 40 ++++++++++ 11 files changed, 267 insertions(+), 18 deletions(-) delete mode 100644 public/assets/2022.css create mode 100644 public/assets/makai22.css create mode 100644 public/assets/makai22.js create mode 100644 tpl/_layout/copy22.php create mode 100644 tpl/_layout/header22.php create mode 100644 tpl/_layout/sidebar22.php create mode 100644 tpl/index22.php create mode 100644 tpl/master22.php diff --git a/public/assets/2022.css b/public/assets/2022.css deleted file mode 100644 index 63d6744..0000000 --- a/public/assets/2022.css +++ /dev/null @@ -1,12 +0,0 @@ -* { - margin: 0; - padding: 0; - box-sizing: border-box; - position: relative; - outline-style: none; -} - -html, body { - width: 100%; - height: 100%; -} diff --git a/public/assets/makai22.css b/public/assets/makai22.css new file mode 100644 index 0000000..83777dc --- /dev/null +++ b/public/assets/makai22.css @@ -0,0 +1,156 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + position: relative; + outline-style: none; +} + +:root { + --site-max-width: 1200px; + --site-border-radius: 10px; +} + +html, body { + width: 100%; + height: 100%; + scrollbar-color: #4a3650 #111; +} + +.makai22 { + width: 100%; + height: 100%; + background-color: #111; + color: #fff; + font-size: 16px; + line-height: 24px; + font-family: Tahoma, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif; +} + +.head { + padding: 10px 0; +} + +.head-float { + overflow: hidden; + margin: 0 auto; + max-width: var(--site-max-width); + width: 100%; + border-radius: var(--site-border-radius); + box-shadow: 0 1px 5px #222; +} + +.head-float-bg { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + overflow: hidden; +} +.head-float-bg img { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + object-fit: cover; + filter: blur(20px) brightness(80%); + transform: scale(1.2); + opacity: 1; + transition: opacity .5s; + pointer-events: none; +} + +.head-float-fg { + display: flex; + flex-direction: column; + width: 100%; + height: 100%; +} +.head-float-fg-logo { + flex: 1 1 auto; + padding: 30px 30px 20px; +} +.head-float-fg-nav { + flex: 0 0 auto; +} + +.fw-logo { + font-family: 'Electrolize', Verdana, 'Dejavu Sans', Arial, Helvetica, sans-serif; + font-size: 3em; + line-height: 1.2em; + filter: drop-shadow(0 1px 5px #000); +} +.fw-logo-link { + color: transparent; + text-decoration: none; + display: inline-flex; + flex: 0 0 auto; +} +.fw-logo-flash { + background-image: linear-gradient(180deg, #eee 0%, #ddd 50%, #ccc 50%, #aaa 100%); + background-clip: text; + -webkit-background-clip: text; +} +.fw-logo-wave { + background-image: linear-gradient(0deg, #281430 0%, #392540 50%, #4a3650 50%, #6c5871 100%); + -webkit-background-clip: text; +} + +.topnav { + display: flex; + margin: 0 8px; +} +.topnav-item { + display: block; + margin: 0 2px 10px; + padding: 5px; + text-decoration: none; + color: #fff; + min-width: 100px; + text-align: center; + border-radius: var(--site-border-radius); + text-shadow: 0 1px 5px #000; + transition: background-color .1s; +} +.topnav-item:hover, +.topnav-item:focus { + background-color: #fff1; +} +.topnav-item:active { + background-color: #8881; +} + +.layout { + max-width: var(--site-max-width); + margin: 0 auto; + display: flex; +} +.layout-main { + flex: 1 1 auto; +} +.layout-spacer { + flex: 0 0 auto; + width: 5px; +} +.layout-side { + flex: 0 0 auto; + width: 300px; +} + +.copyright { + font-size: 11px; + line-height: 1.5em; + text-align: center; + color: #555; +} + +.container { + width: 100%; + border-radius: var(--site-border-radius); + overflow: hidden; + margin: 5px 0; + box-shadow: 0 1px 5px #222; + background-color: #1f1f1f; +} diff --git a/public/assets/makai22.js b/public/assets/makai22.js new file mode 100644 index 0000000..e69de29 diff --git a/public/index.php b/public/index.php index c7d7c0d..2af4ebe 100644 --- a/public/index.php +++ b/public/index.php @@ -103,6 +103,16 @@ $router->get('/home', function() use ($ctx) { return $ctx->getTemplating()->render('home/index'); }); +$router->get('/2022', function() use ($ctx) { + $db = $ctx->getDatabase(); + + return $ctx->getTemplating()->render('index22', [ + 'projects' => (new Projects($db))->getFeatured(), + 'languages' => new Languages($db), + 'contacts' => (new Contacts($db))->getHomePage(), + ]); +}); + $router->get('/', function() use ($ctx) { $legacyPage = (string)filter_input(INPUT_GET, 'p'); if(!empty($legacyPage)) { diff --git a/src/Template.php b/src/Template.php index 16019c9..c4ff11e 100644 --- a/src/Template.php +++ b/src/Template.php @@ -27,6 +27,7 @@ class Template { $self->remVar = fn(string $name) => $this->vars->removeVar($name); $self->block = fn(string $name, mixed $contents) => $this->context->setBlock($name, new TemplateBlock($self, $contents)); + $self->include = fn(string $name) => $this->context->render($name, [], $self); $self->ctx = $this->context; $self->extends = fn(string $name) => $self->extends = $name; diff --git a/src/TemplateContext.php b/src/TemplateContext.php index 44aa7b9..e27fb79 100644 --- a/src/TemplateContext.php +++ b/src/TemplateContext.php @@ -9,11 +9,15 @@ class TemplateContext { private string $pathFormat = '%s' . self::EXT; private TemplateVars $vars; private array $blocks = []; + private array $functions = []; public function __construct($path = '') { if(!empty($path)) $this->pathFormat = rtrim($path, '\\/') . DIRECTORY_SEPARATOR . '%s' . self::EXT; $this->vars = new TemplateVars; + $this->defineFunction('global', $this->vars->getVar(...)); + $this->defineFunction('getBlock', $this->getBlock(...)); + $this->defineFunction('x', fn(string $string) => htmlspecialchars($string, ENT_QUOTES, 'utf-8', true)); } public function setGlobal(string $name, mixed $value): void { @@ -23,13 +27,11 @@ class TemplateContext { $this->vars->removeVar($name); } + public function defineFunction(string $name, Closure|callable $function): void { + $this->functions[$name] = $function; + } public function getFunctions(): array { - return [ - 'global' => $this->vars->getVar(...), - 'getBlock' => $this->getBlock(...), - 'x' => fn(string $string) => htmlspecialchars($string, ENT_QUOTES, 'utf-8', true), - 'e' => function() { return ''; }, // reserve for the HTML builder - ]; + return $this->functions; } public function create(string $path): Template { diff --git a/tpl/_layout/copy22.php b/tpl/_layout/copy22.php new file mode 100644 index 0000000..9989e0b --- /dev/null +++ b/tpl/_layout/copy22.php @@ -0,0 +1,4 @@ + diff --git a/tpl/_layout/header22.php b/tpl/_layout/header22.php new file mode 100644 index 0000000..c1a4890 --- /dev/null +++ b/tpl/_layout/header22.php @@ -0,0 +1,22 @@ +
+
+
+ +
+ +
+
diff --git a/tpl/_layout/sidebar22.php b/tpl/_layout/sidebar22.php new file mode 100644 index 0000000..e69de29 diff --git a/tpl/index22.php b/tpl/index22.php new file mode 100644 index 0000000..37947cc --- /dev/null +++ b/tpl/index22.php @@ -0,0 +1,26 @@ +extends('master22'); + +$self->header_title = 'flash.moe'; + +$self->block('main', function($self) { +?> +
+ blah +
+
+ blah +
+block('sidebar', function($self) { +?> +
+ blah +
+
+ blah +
+ + + + + <?=($self->header_title ?? 'flash.moe');?> + + + + + + + include('_layout/header22');?> + container_type ?? ''): case 'linear': ?> +
+ getBlock('main');?> +
+ + +
+
+
+ getBlock('main');?> +
+
+
+
+ +
+
+ + + +