🏗️ Finish post reward widget coding.

This commit is contained in:
凡梦星尘 2022-06-04 16:15:35 +08:00
parent df06c05c4e
commit 109a749260
11 changed files with 64 additions and 11 deletions

View File

@ -1,7 +1,7 @@
@if $follow_me { @if $follow_me {
.followme { .followme {
color: $grey; color: $grey;
padding: 1em 1.5em; /* padding: 1em 1.5em; */
text-align: center; text-align: center;
@include post-card(); @include post-card();
border-left: none; border-left: none;

View File

@ -3,6 +3,11 @@
padding: 1em 0; padding: 1em 0;
text-align: center; text-align: center;
div>i {
font-size: 1.85em;
margin-right: 4px;
}
button { button {
@include button($sidebar-highlight); @include button($sidebar-highlight);
border: 2px solid $sidebar-highlight; border: 2px solid $sidebar-highlight;
@ -21,7 +26,7 @@
display: block; display: block;
} }
div { .post-reward-item {
display: inline-block; display: inline-block;
span { span {
@ -29,19 +34,23 @@
} }
@if $reward_settings_animation { @if $reward_settings_animation {
&:hover span { &:hover span {
animation: next-roll .1s infinite linear; animation: next-roll .1s infinite linear;
// The animation may affect :hover of img in dark mode // The animation may affect :hover of img in dark mode
pointer-events: none; pointer-events: none;
} }
}
}
} }
img { img {
display: inline-block; display: inline-block;
margin: .8em 2em 0; margin: .8em 1.2em;
max-width: 100%; max-width: 100%;
width: 180px; width: 180px;
border: #eee 1px solid;
box-shadow:rgba(0,0,0,0.2) 0 1px 5px 0px;
} }
} }

View File

@ -339,13 +339,13 @@ params:
# Front-matter variable (nonsupport animation). # Front-matter variable (nonsupport animation).
rewardSets: rewardSets:
# If true, a donate button will be displayed in every article by default. # If true, a donate button will be displayed in every article by default.
enable: false enable: true
animation: false animation: true
#comment: Buy me a coffee comment: '<i class="fa-solid fa-mug-hot"></i>请我喝杯咖啡吧 ヾ(^▽^*)))'
reward: reward:
#wechatpay: /images/wechatpay.png wechatpay: /imgs/wechat-pay.png
#alipay: /images/alipay.png alipay: /imgs/ali-pay.png
#paypal: /images/paypal.png #paypal: /images/paypal.png
#bitcoin: /images/bitcoin.png #bitcoin: /images/bitcoin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -71,6 +71,17 @@ PostCRLicenseContent:
PostFollowMe: PostFollowMe:
other: Welcome to my other publishing channels other: Welcome to my other publishing channels
RewardDonate:
other: Donate
RewardWechatpay:
other: Wechat Pay
RewardAlipay:
other: Alipay
RewardPaypal:
other: PayPal
RewardBitcoin:
other: Bitcoin
VisitorsLabel: VisitorsLabel:
other: Total Visitors other: Total Visitors
PageViewsLabel: PageViewsLabel:

View File

@ -73,6 +73,17 @@ PostCRLicenseContent:
PostFollowMe: PostFollowMe:
other: 欢迎关注我的其它发布渠道 other: 欢迎关注我的其它发布渠道
RewardDonate:
other: 赞赏
RewardWechatpay:
other: 微信
RewardAlipay:
other: 支付宝
RewardPaypal:
other: PayPal
RewardBitcoin:
other: 比特币
UserVistorsLabel: UserVistorsLabel:
other: 总访客量 other: 总访客量
PageViewsLabel: PageViewsLabel:

View File

@ -9,8 +9,9 @@
{{- end }} {{- end }}
<div class="post-eof"></div> <div class="post-eof"></div>
{{- else }} {{- else }}
{{ partial "post/post_copyright.html" . }} {{ partial "post/post_footer/post_reward.html" . }}
{{ partial "post/post_followme.html" . }} {{ partial "post/post_footer/post_copyright.html" . }}
{{ partial "post/post_footer/post_followme.html" . }}
<div class="post-nav"> <div class="post-nav">
<div class="post-nav-next post-nav-item"> <div class="post-nav-next post-nav-item">
{{- with .NextInSection }} {{- with .NextInSection }}

View File

@ -0,0 +1,21 @@
{{- with .Site.Params.rewardSets }}
{{- if .enable }}
<div class="reward-container">
<div>{{- .comment | safeHTML -}}</div>
<button>
{{- T "RewardDonate" -}}
</button>
<div class="post-reward">
{{- range $name,$img := $.Site.Params.reward }}
{{- $fw := substr $name 0 1 }}
{{- $pay := replace $name $fw ($fw | upper) 1 }}
{{- $payName := T (printf "Reward%s" $pay) }}
<div class="post-reward-item">
<img src="{{ $img }}" alt="{{ $.Site.Params.author }} - {{ $payName }}">
<span>{{ $payName }}</span>
</div>
{{- end }}
</div>
</div>
{{- end }}
{{- end }}