From 38f90ea8bfbd4b416811c8703456bcb0aaf794da Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Thu, 12 Dec 2019 22:49:20 -0700 Subject: [PATCH] Implemented theme config and dark-mode --- app/themes/default/config.php | 6 ++++++ app/themes/default/functions.php | 23 +++++++++++++++++++++- app/themes/default/index.twig | 8 ++++---- app/themes/default/src/sass/app.scss | 2 ++ app/themes/default/src/sass/dark-mode.scss | 23 ++++++++++++++++++++++ app/themes/default/webpack.mix.js | 6 +++--- 6 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 app/themes/default/config.php create mode 100644 app/themes/default/src/sass/dark-mode.scss diff --git a/app/themes/default/config.php b/app/themes/default/config.php new file mode 100644 index 0000000..d960444 --- /dev/null +++ b/app/themes/default/config.php @@ -0,0 +1,6 @@ + false +]; diff --git a/app/themes/default/functions.php b/app/themes/default/functions.php index 98f2fb6..d7e4a2d 100644 --- a/app/themes/default/functions.php +++ b/app/themes/default/functions.php @@ -13,6 +13,27 @@ return [ : $icons[$file->getExtension()] ?? 'fas fa-file'; return ""; - }) + }), + + /** + * Retrieve an item from the theme config. + * + * @param string $key + * @param mixed $default + * + * @return mixed + */ + new TwigFunction('config', function (string $key, $default = null) { + $config = require __DIR__ . '/config.php'; + + foreach (explode('.', $key) as $k) { + if (! isset($config[$k])) { + return $default; + } + $config = $config[$k]; + } + + return $config; + }), ] ]; diff --git a/app/themes/default/index.twig b/app/themes/default/index.twig index ff585c7..adbd24d 100644 --- a/app/themes/default/index.twig +++ b/app/themes/default/index.twig @@ -6,8 +6,8 @@ Directory Lister -
-
+
+ -
-
    +
    +
      File Name diff --git a/app/themes/default/src/sass/app.scss b/app/themes/default/src/sass/app.scss index 8d48858..6dac30c 100644 --- a/app/themes/default/src/sass/app.scss +++ b/app/themes/default/src/sass/app.scss @@ -11,3 +11,5 @@ $fa-font-path: "./webfonts"; // Fonts // @import url("https://fonts.googleapis.com/css?family=Lato"); + +@import "dark-mode.scss"; diff --git a/app/themes/default/src/sass/dark-mode.scss b/app/themes/default/src/sass/dark-mode.scss new file mode 100644 index 0000000..e2a07fa --- /dev/null +++ b/app/themes/default/src/sass/dark-mode.scss @@ -0,0 +1,23 @@ +#app.dark-mode { + @apply bg-gray-800; + + header { + @apply bg-purple-700; + } + + #content { + @apply text-white; + } + + #file-list a:hover { + @apply bg-purple-700; + } + + footer { + @apply text-white; + + a:hover { + @apply text-purple-600; + } + } +} diff --git a/app/themes/default/webpack.mix.js b/app/themes/default/webpack.mix.js index d3886fc..97d40f8 100644 --- a/app/themes/default/webpack.mix.js +++ b/app/themes/default/webpack.mix.js @@ -15,9 +15,9 @@ mix.copyDirectory( ); mix.purgeCss({ - extensions: ["html", "scss", "twig"], - globs: ["*.twig"], + extensions: ["html", "js", "php", "scss", "twig", "vue"], + globs: ["**/*.php", "**/*.scss", "**/*.twig"], folders: ["src"], - whitelist: ["html", "body", "main"], + whitelist: ["html", "body", "main", "fab", "far", "fas", "fal", "fad"], whitelistPatterns: [/^fa\-/] });