From b8cddfd6c5fd1a8785a9dff6bc3f10f2cde1b788 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Wed, 31 Mar 2021 16:31:11 -0800 Subject: [PATCH] Mkdocs Upgrade (#243) * fix links * actually fix #238 * Feature/mkdocs version bump (#240) * fix links (#239) Co-authored-by: hay-kot * fix #238 * bump mkdocs version * light/dark toggle * light/dark mode css * API_DOCS defaults to True * disable build on push for master Co-authored-by: hay-kot Co-authored-by: hay-kot --- .github/workflows/dockerbuild.prod.yml | 5 ++--- docs/docs/assets/stylesheets/custom.css | 16 +++++++++++----- docs/docs/overrides/api.html | 2 +- docs/docs/overrides/home.html | 14 ++++---------- docs/mkdocs.yml | 14 ++++++++++++++ mealie/core/config.py | 2 +- poetry.lock | 6 +++--- 7 files changed, 36 insertions(+), 23 deletions(-) diff --git a/.github/workflows/dockerbuild.prod.yml b/.github/workflows/dockerbuild.prod.yml index f3dd6ab6e09..b07908b7c59 100644 --- a/.github/workflows/dockerbuild.prod.yml +++ b/.github/workflows/dockerbuild.prod.yml @@ -1,9 +1,8 @@ name: Docker Build Production on: - push: - branches: - - master + release: + types: [published] jobs: build: diff --git a/docs/docs/assets/stylesheets/custom.css b/docs/docs/assets/stylesheets/custom.css index ef731b486ff..8cad0f7baad 100644 --- a/docs/docs/assets/stylesheets/custom.css +++ b/docs/docs/assets/stylesheets/custom.css @@ -1,14 +1,20 @@ -:root { +[data-md-color-scheme="mealie"] { --md-primary-fg-color: #e58325; --md-primary-fg-color--light: #e58325; - --md-primary-fg-color--dark: #e58325; --md-accent-fg-color: #e58325; + --md-custom-h2-color: #333; --md-accent-fg-color--light: #e58325; - --md-accent-fg-color--dark: #e58325; + --md-default-accent-bg-color: #f7fafc; } -body { - background: var(--md-primary-bg-color); +[data-md-color-scheme="slate"] { + --md-primary-fg-color: #e58325; + --md-primary-fg-color--dark: #e58325; + --md-accent-fg-color: #e58325; + --md-accent-fg-color--dark: #e58325; + --md-custom-h2-color: rgb(167, 167, 167); + --md-default-bg-color: #1a1b1b; + --md-default-accent-bg-color: #1f1e1e; } /* frontpage elements */ diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html index 50778c3f387..5249b0d34e3 100644 --- a/docs/docs/overrides/api.html +++ b/docs/docs/overrides/api.html @@ -14,7 +14,7 @@
diff --git a/docs/docs/overrides/home.html b/docs/docs/overrides/home.html index bf1991973bf..6906317c43c 100644 --- a/docs/docs/overrides/home.html +++ b/docs/docs/overrides/home.html @@ -16,7 +16,6 @@ .tx-container { padding-top: .0rem; - background: var(--md-primary-bg-color) } .tx-hero { @@ -27,7 +26,7 @@ .tx-hero h1 { margin-bottom: 1rem; font-family: "Roboto"; - color: #30353a; + color: var(--md-custom-h2-color); font-weight: 500 } @@ -68,7 +67,7 @@ } .feature-container { - background-color: #F7FAFC; + background-color: var(--md-default-accent-bg-color); } .top-hr { @@ -85,7 +84,7 @@ } .feature-item h2 { - color: #333; + color: var(--md-custom-h2-color); font-weight: 300; font-size: 25px; white-space: nowrap; @@ -102,7 +101,7 @@ line-height: 1.8em; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; - color: #111; + color: var(--webkit-print-color-adjust); margin: 0 0 10px; display: block; } @@ -162,11 +161,6 @@ flex: 1; min-width: 0; } - - /* .feature-item:hover { - background-color: #fea55247; - border-radius: 3px; - } */ } .hr { diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 332622fae6d..080c3ca3d54 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -1,8 +1,22 @@ site_name: Mealie demo_url: https://mealie-demo.hay-kot.dev/ theme: + palette: + # Light mode + - media: "(prefers-color-scheme: light)" + scheme: mealie + toggle: + icon: material/weather-night + name: Switch to dark mode + # Dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/weather-sunny + name: Switch to light mode custom_dir: docs/overrides features: + - navigation.top - navigation.instant - navigation.expand - navigation.sections diff --git a/mealie/core/config.py b/mealie/core/config.py index e1a7fb8b1d4..aca765dfff1 100644 --- a/mealie/core/config.py +++ b/mealie/core/config.py @@ -80,7 +80,7 @@ def __init__(self, app_dirs: AppDirectories) -> None: self.PRODUCTION = bool(os.environ.get("ENV")) self.IS_DEMO = os.getenv("DEMO", "False") == "True" self.API_PORT = int(os.getenv("API_PORT", 9000)) - self.API = os.getenv("API_DOCS", "False") == "True" + self.API = os.getenv("API_DOCS", "True") == "True" self.DOCS_URL = "/docs" if self.API else None self.REDOC_URL = "/redoc" if self.API else None self.SECRET = determine_secrets(app_dirs.DATA_DIR, self.PRODUCTION) diff --git a/poetry.lock b/poetry.lock index 997e7460a16..ca38853c403 100644 --- a/poetry.lock +++ b/poetry.lock @@ -519,7 +519,7 @@ tornado = ">=5.0" [[package]] name = "mkdocs-material" -version = "7.0.6" +version = "7.1.0" description = "A Material Design theme for MkDocs" category = "dev" optional = false @@ -1577,8 +1577,8 @@ mkdocs = [ {file = "mkdocs-1.1.2.tar.gz", hash = "sha256:f0b61e5402b99d7789efa032c7a74c90a20220a9c81749da06dbfbcbd52ffb39"}, ] mkdocs-material = [ - {file = "mkdocs-material-7.0.6.tar.gz", hash = "sha256:e1423286dcb2ac6b9417e9e04a3f63a97f12f7f64802af09c8257561e9f3a319"}, - {file = "mkdocs_material-7.0.6-py2.py3-none-any.whl", hash = "sha256:a89f8a08a5f0a5ecce2c7a4a61a1ddd2c2cbac86f17978264eb8b8ce2ca5411b"}, + {file = "mkdocs-material-7.1.0.tar.gz", hash = "sha256:1afaa5b174265eaa4a886f73187bb0e302a9596e9bfedb5aa2cb260d8b1d994e"}, + {file = "mkdocs_material-7.1.0-py2.py3-none-any.whl", hash = "sha256:13e73b3571d36f7e4a7dc11093323cff92095f4f219a00ba19c77a5e53aa6c55"}, ] mkdocs-material-extensions = [ {file = "mkdocs-material-extensions-1.0.1.tar.gz", hash = "sha256:6947fb7f5e4291e3c61405bad3539d81e0b3cd62ae0d66ced018128af509c68f"},