Refactor post-footer using flex layout

This commit is contained in:
Mimi 2020-08-17 10:46:46 +08:00
parent b07a2a2913
commit 23d9163a2d
5 changed files with 61 additions and 53 deletions

View File

@ -201,7 +201,10 @@
{{ partial('_partials/post/post-related.njk') }} {{ partial('_partials/post/post-related.njk') }}
{%- endif %} {%- endif %}
{%- if not is_index %} <footer class="post-footer">
{%- if is_index %}
<div class="post-eof"></div>
{% else %}
{{- next_inject('postBodyEnd') }} {{- next_inject('postBodyEnd') }}
{%- if post.reward_settings.enable %} {%- if post.reward_settings.enable %}
@ -216,7 +219,6 @@
{{ partial('_partials/post/post-followme.njk', {}, {cache: theme.cache.enable}) }} {{ partial('_partials/post/post-followme.njk', {}, {cache: theme.cache.enable}) }}
{%- endif %} {%- endif %}
<footer class="post-footer">
{%- if post.tags and post.tags.length %} {%- if post.tags and post.tags.length %}
{%- set tag_indicate = '<i class="fa fa-tag"></i>' if theme.tag_icon else '#' %} {%- set tag_indicate = '<i class="fa fa-tag"></i>' if theme.tag_icon else '#' %}
<div class="post-tags"> <div class="post-tags">
@ -248,12 +250,9 @@
</div> </div>
</div> </div>
{%- endif %} {%- endif %}
</footer>
{% else %}
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
{%- endif %} {%- endif %}
</footer>
</article> </article>
{######################} {######################}
{### END POST BLOCK ###} {### END POST BLOCK ###}

View File

@ -1,8 +1,8 @@
{%- set ccIcon = '<i class="fab fa-fw fa-creative-commons"></i>' %} {%- set ccIcon = '<i class="fab fa-fw fa-creative-commons"></i>' %}
{%- set ccText = theme.creative_commons.license | upper %} {%- set ccText = theme.creative_commons.license | upper %}
<div> <div class="post-copyright">
<ul class="post-copyright"> <ul>
<li class="post-copyright-author"> <li class="post-copyright-author">
<strong>{{ __('post.copyright.author') + __('symbol.colon') }} </strong> <strong>{{ __('post.copyright.author') + __('symbol.colon') }} </strong>
{{- page.author or author }} {{- page.author or author }}

View File

@ -0,0 +1,41 @@
// Flexbox layout makes it possible to reorder the child
// elements of .post-footer through the `order` CSS property
// Fix issue #16
// To do: use `gap` instead of `margin-bottom`
// See https://caniuse.com/#feat=flexbox-gap
.post-footer {
flex-column();
}
.post-eof {
background: $grey-light;
height: 1px;
margin: $post-eof-margin-top auto $post-eof-margin-bottom;
width: 8%;
.post-block:last-of-type & {
display: none;
}
}
if (hexo-config('creative_commons.post')) {
.post-copyright ul {
list-style: none;
padding: .5em 1em;
post-card();
}
}
.post-tags {
margin-top: 40px;
text-align: center;
a {
display: inline-block;
font-size: $font-size-smaller;
&:not(:last-child) {
margin-right: 10px;
}
}
}

View File

@ -1,13 +0,0 @@
.post-tags {
margin-top: 40px;
text-align: center;
a {
display: inline-block;
font-size: $font-size-smaller;
&:not(:last-child) {
margin-right: 10px;
}
}
}

View File

@ -16,25 +16,6 @@
text-align: center; text-align: center;
} }
if (hexo-config('creative_commons.post')) {
.post-copyright {
list-style: none;
padding: .5em 1em;
post-card();
}
}
.post-eof {
background: $grey-light;
height: 1px;
margin: $post-eof-margin-top auto $post-eof-margin-bottom;
width: 8%;
.post-block:last-of-type & {
display: none;
}
}
.use-motion { .use-motion {
if (hexo-config('motion.transition.post_block')) { if (hexo-config('motion.transition.post_block')) {
.post-block, .pagination, .comments { .post-block, .pagination, .comments {
@ -66,7 +47,7 @@ if (hexo-config('creative_commons.post')) {
@import 'post-gallery'; @import 'post-gallery';
@import 'post-header'; @import 'post-header';
@import 'post-nav'; @import 'post-nav';
@import 'post-tags'; @import 'post-footer';
@import 'post-widgets'; @import 'post-widgets';
@import 'post-reward'; @import 'post-reward';