From 08aad5370e64b73dd49f5aadc77e9c766b383630 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 19 Jan 2023 18:59:49 +0800 Subject: [PATCH] enhance subscribe form styling --- assets/css/extended/newsletter.scss | 65 +++++++++++++++++------ layouts/_default/single.html | 2 +- layouts/partials/newsletter_sub_form.html | 2 +- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index a7ac2ab..0433950 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -13,6 +13,7 @@ body.type-newsletter { --signature: #CB3A56; --signature-bg: rgba(203, 58, 87, 0.239); --signature-bg-dim: rgba(203, 58, 87, 0.147); + --signature-bg-dimmer: rgba(203, 58, 87, 0.084); --main-border: 5px solid var(--signature); --icon-length: 50px; --icon-font-size: 32px; @@ -43,19 +44,27 @@ body.type-newsletter { } /* shared */ - .sub-form { - display: flex; - flex-direction: column; - margin: calc(var(--content-gap) * 1.5) 0; + .subscribe-form { + margin: calc(var(--content-gap) * 2) 0; + form { display: flex; + flex-direction: column; line-height: 1.2em; flex-wrap: wrap; } - input { + .input-group { + display: flex; + flex-wrap: wrap; + } + .subscribe-option { + margin-top: 8px; + } + input[type=text] { border: 3px solid var(--signature-bg-dim); color: var(--secondary); border-radius: 0px; + border-color: var(--signature-bg); appearance: none; outline: none; background-color: var(--theme); @@ -68,7 +77,7 @@ body.type-newsletter { border-color: var(--signature); } } - button, input[type=submit] { + button { display: block; background-color: var(--signature); color: var(--theme); @@ -76,13 +85,40 @@ body.type-newsletter { margin-left: var(--content-gap); white-space: nowrap; } + label, .label { + font-size: .85em; + margin-right: 16px; + } + .label { + color: var(--secondary); + line-height: 1.2; + } + input[type=radio] { + margin-left: 0; + margin-top: 0; + } } + @media screen and (max-width: $small) { - .sub-form { + .subscribe-form { + font-size: .9em; + input[type=text] { + padding-left: 8px; + padding-right: 8px; + } button { + width: 96px; margin-left: 0; - margin-top: calc(var(--content-gap)/2); - flex-grow: 1; + padding-left: 0; + padding-right: 0; + } + .hide-for-sm { + display: none; + } + .label { + display: block; + width: 100%; + margin-bottom: 4px; } } } @@ -284,18 +320,15 @@ body.type-newsletter.kind-page { .newsletter-sub { margin-top: calc(var(--content-gap) * 1.5); - background-color: var(--signature-bg-dim); - padding: 1.5em 1.2em 1.2em; + background-color: var(--signature-bg-dimmer); + padding: var(--content-gap) var(--gap); .notice { font-size: .9em; color: var(--signature); line-height: 1.6; } - .sub-form { - margin: 1em 0; - input { - border-color: var(--signature-bg); - } + .subscribe-form { + margin: var(--content-gap) 0 0; } } } diff --git a/layouts/_default/single.html b/layouts/_default/single.html index acacc2c..4b48580 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -56,7 +56,7 @@ {{- if $isNewsletter }}
- Thanks for reading, if you like it, please subscribe below.
+
Thanks for reading, if you like it, please subscribe below.
感谢你能读到这里,如果觉得有趣的话,欢迎在下方输入邮箱进行订阅。
{{- partial "newsletter_sub_form.html"}} diff --git a/layouts/partials/newsletter_sub_form.html b/layouts/partials/newsletter_sub_form.html index 4735e79..bebc5c9 100644 --- a/layouts/partials/newsletter_sub_form.html +++ b/layouts/partials/newsletter_sub_form.html @@ -1,6 +1,6 @@ {{/* Add `layouts/partials/newsletter_sub_form.html` in your own code to customize the form */}} -
+