From c9cde633e1ed2dddd0edc986b895efbc46f88e84 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:00:28 +0530 Subject: [PATCH] Add loadables for - ShowCodeCopyButtons - ShowPostNavLinks - ShowShareButtons - disableAnchoredHeadings --- assets/css/common/main.css | 18 ----- assets/css/common/post-single.css | 78 ------------------- assets/css/includes/anchored-headings.css | 11 +++ .../css/includes/show-code-copy-buttons.css | 16 ++++ assets/css/includes/show-post-nav-links.css | 37 +++++++++ assets/css/includes/show-share-buttons.css | 26 +++++++ layouts/partials/head_styles.html | 20 +++++ 7 files changed, 110 insertions(+), 96 deletions(-) create mode 100644 assets/css/includes/anchored-headings.css create mode 100644 assets/css/includes/show-code-copy-buttons.css create mode 100644 assets/css/includes/show-post-nav-links.css create mode 100644 assets/css/includes/show-share-buttons.css diff --git a/assets/css/common/main.css b/assets/css/common/main.css index 50022ac..cccf3da 100644 --- a/assets/css/common/main.css +++ b/assets/css/common/main.css @@ -48,21 +48,3 @@ div.highlight, pre { position: relative; } - -.copy-code { - display: none; - position: absolute; - top: 4px; - right: 4px; - color: rgba(255, 255, 255, 0.8); - background: rgba(78, 78, 78, 0.8); - border-radius: var(--radius); - padding: 0 5px; - font-size: 14px; - user-select: none; -} - -div.highlight:hover .copy-code, -pre:hover .copy-code { - display: block; -} diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 79ccbec..0ff6650 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -329,46 +329,6 @@ background: var(--border); } -.share-buttons { - margin: 14px 0; - padding-inline-start: var(--radius); - display: flex; - justify-content: center; - overflow-x: auto; -} - -.share-buttons a { - margin-top: 10px; -} - -.share-buttons a:not(:last-of-type) { - margin-inline-end: 12px; -} - -.share-buttons a svg { - height: 30px; - width: 30px; - fill: currentColor; - transition: transform 0.1s; -} - -.share-buttons svg:active { - transform: scale(0.96); -} - -h1:hover .anchor, -h2:hover .anchor, -h3:hover .anchor, -h4:hover .anchor, -h5:hover .anchor, -h6:hover .anchor { - display: inline-flex; - color: var(--secondary); - margin-inline-start: 8px; - font-weight: 500; - user-select: none; -} - .post-content :not(table) ::-webkit-scrollbar-thumb { border: 2px solid var(--hljs-bg); background: rgb(113, 113, 117); @@ -390,41 +350,3 @@ h6:hover .anchor { .post-content table::-webkit-scrollbar-thumb { border-width: 2px; } - -.paginav { - margin: 10px 0; - display: flex; - line-height: 30px; - border-radius: var(--radius); -} - -.paginav a { - padding-inline-start: 14px; - padding-inline-end: 14px; - border-radius: var(--radius); -} - -.paginav .title { - letter-spacing: 1px; - text-transform: uppercase; - font-size: small; - color: var(--secondary); -} - -.paginav .prev, -.paginav .next { - width: 50%; -} - -.paginav span:hover:not(.title) { - box-shadow: 0 1px 0; -} - -.paginav .next { - margin-inline-start: auto; - text-align: right; -} - -[dir="rtl"] .paginav .next { - text-align: left; -} diff --git a/assets/css/includes/anchored-headings.css b/assets/css/includes/anchored-headings.css new file mode 100644 index 0000000..8044e1c --- /dev/null +++ b/assets/css/includes/anchored-headings.css @@ -0,0 +1,11 @@ +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-flex; + color: var(--secondary); + margin-inline-start: 8px; + font-weight: 500; +} diff --git a/assets/css/includes/show-code-copy-buttons.css b/assets/css/includes/show-code-copy-buttons.css new file mode 100644 index 0000000..49ac1bf --- /dev/null +++ b/assets/css/includes/show-code-copy-buttons.css @@ -0,0 +1,16 @@ +.copy-code { + display: none; + position: absolute; + top: 4px; + right: 4px; + color: rgba(255, 255, 255, 0.8); + background: rgba(78, 78, 78, 0.8); + border-radius: var(--radius); + padding: 0 5px; + font-size: 14px; +} + +div.highlight:hover .copy-code, +pre:hover .copy-code { + display: block; +} diff --git a/assets/css/includes/show-post-nav-links.css b/assets/css/includes/show-post-nav-links.css new file mode 100644 index 0000000..07b522a --- /dev/null +++ b/assets/css/includes/show-post-nav-links.css @@ -0,0 +1,37 @@ +.paginav { + margin: 10px 0; + display: flex; + line-height: 30px; + border-radius: var(--radius); +} + +.paginav a { + padding-inline-start: 14px; + padding-inline-end: 14px; + border-radius: var(--radius); +} + +.paginav .title { + letter-spacing: 1px; + text-transform: uppercase; + font-size: small; + color: var(--secondary); +} + +.paginav .prev, +.paginav .next { + width: 50%; +} + +.paginav span:hover:not(.title) { + box-shadow: 0 1px 0; +} + +.paginav .next { + margin-inline-start: auto; + text-align: right; +} + +[dir="rtl"] .paginav .next { + text-align: left; +} diff --git a/assets/css/includes/show-share-buttons.css b/assets/css/includes/show-share-buttons.css new file mode 100644 index 0000000..89d94d1 --- /dev/null +++ b/assets/css/includes/show-share-buttons.css @@ -0,0 +1,26 @@ +.share-buttons { + margin: 14px 0; + padding-inline-start: var(--radius); + display: flex; + justify-content: center; + overflow-x: auto; +} + +.share-buttons a { + margin-top: 10px; +} + +.share-buttons a:not(:last-of-type) { + margin-inline-end: 12px; +} + +.share-buttons a svg { + height: 30px; + width: 30px; + fill: currentColor; + transition: transform 0.1s; +} + +.share-buttons svg:active { + transform: scale(0.96); +} diff --git a/layouts/partials/head_styles.html b/layouts/partials/head_styles.html index 116bbab..2387e51 100644 --- a/layouts/partials/head_styles.html +++ b/layouts/partials/head_styles.html @@ -23,6 +23,26 @@ {{- $includes = (append $profileMode $includes) }} {{- end }} +{{- if not (eq .Site.Params.features.ShowCodeCopyButtons false) }} + {{- $ShowCodeCopyButtons := (resources.Get "css/includes/show-code-copy-buttons.css") }} + {{- $includes = (append $ShowCodeCopyButtons $includes) }} +{{- end }} + +{{- if not (eq .Site.Params.features.ShowPostNavLinks false) }} + {{- $ShowPostNavLinks := (resources.Get "css/includes/show-post-nav-links.css") }} + {{- $includes = (append $ShowPostNavLinks $includes) }} +{{- end }} + +{{- if not (eq .Site.Params.features.ShowShareButtons false) }} + {{- $ShowShareButtons := (resources.Get "css/includes/show-share-buttons.css") }} + {{- $includes = (append $ShowShareButtons $includes) }} +{{- end }} + +{{- if not (eq .Site.Params.features.disableAnchoredHeadings true) }} + {{- $AnchoredHeadings := (resources.Get "css/includes/show-share-buttons.css") }} + {{- $includes = (append $AnchoredHeadings $includes) }} +{{- end }} + {{- $includes_all := $includes | resources.Concat "assets/css/includes.css" }} {{- /* order is important */}}