perf(ui): improve related posts design
This commit is contained in:
parent
97b8dfeed6
commit
2918da9f29
9 changed files with 48 additions and 75 deletions
|
@ -85,11 +85,10 @@
|
||||||
{% for entry in index_list %}
|
{% for entry in index_list %}
|
||||||
{% assign index = entry | plus: 0 %}
|
{% assign index = entry | plus: 0 %}
|
||||||
{% assign post = site.posts[index] %}
|
{% assign post = site.posts[index] %}
|
||||||
<div class="card">
|
<a href="{{ post.url | relative_url }}" class="card post-preview">
|
||||||
<a href="{{ post.url | relative_url }}">
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% include datetime.html date=post.date class="small" lang=include.lang %}
|
{% include datetime.html date=post.date class="small" lang=include.lang %}
|
||||||
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
|
<h3 class="pt-0 mt-2 mb-3" data-toc-skip>{{ post.title }}</h3>
|
||||||
<div class="text-muted small">
|
<div class="text-muted small">
|
||||||
<p>
|
<p>
|
||||||
{% include no-linenos.html content=post.content %}
|
{% include no-linenos.html content=post.content %}
|
||||||
|
@ -98,7 +97,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<!-- .card-deck -->
|
<!-- .card-deck -->
|
||||||
|
|
|
@ -43,7 +43,7 @@ refactor: true
|
||||||
<div id="post-list">
|
<div id="post-list">
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<a href="{{ post.url | relative_url }}" class="card-wrapper">
|
<a href="{{ post.url | relative_url }}" class="card-wrapper">
|
||||||
<div class="card flex-md-row-reverse">
|
<div class="card post-preview flex-md-row-reverse">
|
||||||
{% if post.image %}
|
{% if post.image %}
|
||||||
{% if post.image.lqip %}
|
{% if post.image.lqip %}
|
||||||
{% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
|
{% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
|
||||||
|
|
|
@ -204,12 +204,12 @@ footer {
|
||||||
@extend %text-color;
|
@extend %text-color;
|
||||||
|
|
||||||
&:link {
|
&:link {
|
||||||
@include no-text-decoration;
|
@extend %no-decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@extend %link-hover;
|
@extend %link-hover;
|
||||||
@include no-text-decoration;
|
@extend %no-decoration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,10 +647,26 @@ i {
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-text-decoration {
|
.no-text-decoration {
|
||||||
@include no-text-decoration;
|
@extend %no-decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overrided BS4 Tooltip */
|
.card.post-preview {
|
||||||
|
border-radius: $card-radius;
|
||||||
|
border: 0;
|
||||||
|
background: var(--card-bg);
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.05) 0 6px 14px 0,
|
||||||
|
var(--card-border-color) 0 0 0 1px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--card-hovor-bg);
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: brightness(0.7) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Overwrite bootstrap tooltip */
|
||||||
.tooltip-inner {
|
.tooltip-inner {
|
||||||
font-size: 0.7rem;
|
font-size: 0.7rem;
|
||||||
max-width: 220px;
|
max-width: 220px;
|
||||||
|
@ -733,7 +749,7 @@ $sidebar-display: 'sidebar-display';
|
||||||
@extend %sidebar-links;
|
@extend %sidebar-links;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@include no-text-decoration;
|
@extend %no-decoration;
|
||||||
|
|
||||||
color: var(--sidebar-active-color) !important;
|
color: var(--sidebar-active-color) !important;
|
||||||
}
|
}
|
||||||
|
@ -930,6 +946,14 @@ $sidebar-display: 'sidebar-display';
|
||||||
} /* #sidebar */
|
} /* #sidebar */
|
||||||
|
|
||||||
@media (hover: hover) {
|
@media (hover: hover) {
|
||||||
|
.card.post-preview {
|
||||||
|
transition: all 0.35s ease-in-out;
|
||||||
|
|
||||||
|
img {
|
||||||
|
transition: all 0.35s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#sidebar ul > li:last-child::after {
|
#sidebar ul > li:last-child::after {
|
||||||
transition: top 0.5s ease;
|
transition: top 0.5s ease;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,12 +122,12 @@
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- scss mixin --------- */
|
%no-decoration {
|
||||||
|
|
||||||
@mixin no-text-decoration {
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- scss mixin --------- */
|
||||||
|
|
||||||
@mixin mt-mb($value) {
|
@mixin mt-mb($value) {
|
||||||
margin-top: $value;
|
margin-top: $value;
|
||||||
margin-bottom: $value;
|
margin-bottom: $value;
|
||||||
|
|
|
@ -21,9 +21,9 @@ $topbar-height: 3rem !default;
|
||||||
$search-max-width: 210px !default;
|
$search-max-width: 210px !default;
|
||||||
$footer-height: 5rem !default;
|
$footer-height: 5rem !default;
|
||||||
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */
|
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */
|
||||||
|
|
||||||
$main-content-max-width: 1250px !default;
|
$main-content-max-width: 1250px !default;
|
||||||
$bottom-min-height: 35rem !default;
|
$bottom-min-height: 35rem !default;
|
||||||
|
$card-radius: 0.5rem;
|
||||||
|
|
||||||
/* syntax highlight */
|
/* syntax highlight */
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,7 @@
|
||||||
--relate-post-date: var(--text-muted-color);
|
--relate-post-date: var(--text-muted-color);
|
||||||
--card-bg: #1e1e1e;
|
--card-bg: #1e1e1e;
|
||||||
--card-hovor-bg: #3a3a3a;
|
--card-hovor-bg: #3a3a3a;
|
||||||
--card-border-color: #2e2e2e;
|
--card-border-color: rgba(172, 169, 169, 0.17);
|
||||||
--card-box-shadow: var(--main-bg);
|
|
||||||
--kbd-wrap-color: #6a6a6a;
|
--kbd-wrap-color: #6a6a6a;
|
||||||
--kbd-text-color: #d3d3d3;
|
--kbd-text-color: #d3d3d3;
|
||||||
--kbd-bg-color: #242424;
|
--kbd-bg-color: #242424;
|
||||||
|
|
|
@ -63,8 +63,7 @@
|
||||||
--btn-share-hover-color: var(--link-color);
|
--btn-share-hover-color: var(--link-color);
|
||||||
--card-bg: white;
|
--card-bg: white;
|
||||||
--card-hovor-bg: #e2e2e2;
|
--card-hovor-bg: #e2e2e2;
|
||||||
--card-border-color: #ececec;
|
--card-border-color: rgba(172, 169, 169, 0.13);
|
||||||
--card-box-shadow: rgba(234, 234, 234, 0.76);
|
|
||||||
--label-color: #616161;
|
--label-color: #616161;
|
||||||
--relate-post-date: rgba(30, 55, 70, 0.4);
|
--relate-post-date: rgba(30, 55, 70, 0.4);
|
||||||
--footnote-target-bg: lightcyan;
|
--footnote-target-bg: lightcyan;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Style for Homepage
|
Style for Homepage
|
||||||
*/
|
*/
|
||||||
$card-radius: 0.5rem;
|
|
||||||
|
|
||||||
#post-list {
|
#post-list {
|
||||||
margin-top: 1.75rem;
|
margin-top: 1.75rem;
|
||||||
|
@ -19,31 +18,6 @@ $card-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
border-radius: $card-radius;
|
|
||||||
border: 0;
|
|
||||||
background: var(--card-bg);
|
|
||||||
box-shadow: rgba(0, 0, 0, 0.05) 0 6px 14px 0,
|
|
||||||
rgba(172, 169, 169, 0.08) 0 0 0 1px;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
background: var(--card-hovor-bg);
|
|
||||||
opacity: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: $card-radius;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: var(--card-hovor-bg);
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%img-radius {
|
%img-radius {
|
||||||
border-radius: $card-radius $card-radius 0 0;
|
border-radius: $card-radius $card-radius 0 0;
|
||||||
}
|
}
|
||||||
|
@ -168,16 +142,6 @@ $card-radius: 0.5rem;
|
||||||
} /* .page-item */
|
} /* .page-item */
|
||||||
} /* .pagination */
|
} /* .pagination */
|
||||||
|
|
||||||
@media (hover: hover) {
|
|
||||||
#post-list .card {
|
|
||||||
transition: border-color 0.35s ease-in-out;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
transition: opacity 0.35s ease-in-out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tablet */
|
/* Tablet */
|
||||||
@media all and (min-width: 768px) {
|
@media all and (min-width: 768px) {
|
||||||
#post-list {
|
#post-list {
|
||||||
|
|
|
@ -333,24 +333,13 @@ h1 + .post-meta {
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: none;
|
@extend %no-decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
border-color: var(--card-border-color);
|
|
||||||
background-color: var(--card-bg);
|
|
||||||
box-shadow: 0 0 5px 0 var(--card-box-shadow);
|
|
||||||
transition: all 0.3s ease-in-out;
|
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
@extend %text-color;
|
@extend %text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
|
||||||
-webkit-transform: translate3d(0, -3px, 0);
|
|
||||||
transform: translate3d(0, -3px, 0);
|
|
||||||
box-shadow: 0 10px 15px -4px rgba(0, 0, 0, 0.15);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue