summaryrefslogtreecommitdiff
path: root/_includes
diff options
context:
space:
mode:
authorjeffreytse <jeffreytse.mail@gmail.com>2021-06-17 20:39:11 +0800
committerjeffreytse <jeffreytse.mail@gmail.com>2021-06-17 20:39:11 +0800
commitcae6e2e54973d9ccbc9de6954d2dbf0888c1842f (patch)
tree60dc04f2c75d0291807f1197eadc8dabb3157c7e /_includes
parent9b06eb1ba9229e1885f6a847ae4a610ea56fcee1 (diff)
feat: support advanced banner configuration
Support to configurate the banner opacity and height.
Diffstat (limited to '_includes')
-rw-r--r--_includes/functions/get_banner.html28
-rw-r--r--_includes/views/banner.html24
-rw-r--r--_includes/views/header.html7
3 files changed, 47 insertions, 12 deletions
diff --git a/_includes/functions/get_banner.html b/_includes/functions/get_banner.html
new file mode 100644
index 0000000..bb19ac2
--- /dev/null
+++ b/_includes/functions/get_banner.html
@@ -0,0 +1,28 @@
+{%- include functions.html func='log' level='debug' msg='Get banner value' -%}
+{% assign name = 'banner' %}
+{%- include functions.html func='get_value' -%}
+{% assign banner = return %}
+
+{%- if banner.first -%}
+ {%- include functions.html func='log' level='debug' msg='Get banner_image value' -%}
+ {% assign name = 'banner.image' %}
+ {%- include functions.html func='get_value' -%}
+ {% assign banner_image = return | relative_url %}
+{%- else -%}
+ {% assign banner_image = banner | relative_url %}
+{%- endif -%}
+
+{%- include functions.html func='log' level='debug' msg='Get banner_background value' -%}
+{% assign name = 'banner.background' %}
+{%- include functions.html func='get_value' -%}
+{% assign banner_background = return %}
+
+{%- include functions.html func='log' level='debug' msg='Get banner_opacity value' -%}
+{% assign name = 'banner.opacity' %}
+{%- include functions.html func='get_value' -%}
+{% assign banner_opacity = return %}
+
+{%- include functions.html func='log' level='debug' msg='Get banner_height value' -%}
+{% assign name = 'banner.height' %}
+{%- include functions.html func='get_value' -%}
+{% assign banner_height = return %}
diff --git a/_includes/views/banner.html b/_includes/views/banner.html
index a6b503f..d77e42c 100644
--- a/_includes/views/banner.html
+++ b/_includes/views/banner.html
@@ -3,11 +3,6 @@
{%- include functions.html func='get_value' -%}
{% assign banner_html = return %}
-{%- include functions.html func='log' level='debug' msg='Get banner value' -%}
-{% assign name = 'banner' %}
-{%- include functions.html func='get_value' -%}
-{% assign banner = return %}
-
{%- include functions.html func='log' level='debug' msg='Get heading value' -%}
{% assign name = 'heading' %}
{%- include functions.html func='get_value' -%}
@@ -18,10 +13,25 @@
{%- include functions.html func='get_value' -%}
{% assign subheading = return %}
-{% if banner %}
+{%- include functions.html func='get_banner' -%}
+
+{% if banner_image %}
+ <style>
+ html .page-banner {
+ height: {{ banner_height }};
+ }
+
+ html .page-banner .page-banner-img > *:first-child {
+ opacity: {{ banner_opacity }};
+ }
+
+ html[data-theme="dark"] .page-banner .page-banner-img > *:first-child {
+ opacity: {{ banner_opacity | times: 0.6 }};
+ }
+ </style>
<section class="page-banner">
<div class="page-banner-img">
- <div style="background-image: url({{ banner | relative_url }})"></div>
+ <div style="background-image: url({{ banner_image }})"></div>
</div>
<div class="wrapper">
<div class="page-banner-inner">
diff --git a/_includes/views/header.html b/_includes/views/header.html
index 3bd063c..d8b43f4 100644
--- a/_includes/views/header.html
+++ b/_includes/views/header.html
@@ -1,15 +1,12 @@
-{%- include functions.html func='log' level='debug' msg='Get banner value' -%}
-{%- assign name = 'banner' -%}
-{%- include functions.html func='get_value' -%}
-{% assign banner = return %}
+{%- include functions.html func='get_banner' -%}
{%- include functions.html func='log' level='debug' msg='Get header_transparent value' -%}
{%- assign name = 'header_transparent' -%}
{%- include functions.html func='get_value' default=true -%}
{%- assign header_transparent = return -%}
-{%- if banner and header_transparent -%}
+{%- if banner_image and header_transparent -%}
{%- assign header_transparent_class = "site-header-transparent" -%}
{%- endif -%}