From 63f19febf9d4abfc902b8dd393b3dec9797c591a Mon Sep 17 00:00:00 2001
From: liuyib <1656081615@qq.com>
Date: Wed, 15 Jan 2020 09:27:25 +0800
Subject: [PATCH] fix: Solved that friends plugin not show normally when
lazyload enabled
---
scripts/tags/friends.js | 37 +++++++++++--------
.../_common/components/plugins/friends.styl | 20 +++++-----
2 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/scripts/tags/friends.js b/scripts/tags/friends.js
index fb2dcc3..ccba41a 100644
--- a/scripts/tags/friends.js
+++ b/scripts/tags/friends.js
@@ -15,28 +15,33 @@ function friends(args) {
}
});
- return fs.readFile(path).then(function(datas) {
- if (!datas) {
+ return fs.readFile(path).then(function(data) {
+ if (!data) {
hexo.log.warn('Include file empty.');
return;
}
- var datas = JSON.parse(datas);
- var result = '
';
+ var friends = JSON.parse(data);
+ var renderHtml = '';
- return result;
+ return renderHtml;
});
}
diff --git a/source/css/_common/components/plugins/friends.styl b/source/css/_common/components/plugins/friends.styl
index 5a305bd..4698515 100644
--- a/source/css/_common/components/plugins/friends.styl
+++ b/source/css/_common/components/plugins/friends.styl
@@ -3,12 +3,13 @@
max-width: 100%;
&__item {
- display: block;
+ display: flex;
float: left;
padding: .5rem 1rem;
width: 50%;
height: 100px;
transition: background-color .3s;
+ align-items: center;
&:hover {
background-color: alpha($blue-light, .1);
@@ -21,22 +22,15 @@
avatar-width = 60px;
&-avatar {
- display: inline-block;
+ margin: 0 1rem 0 0;
border-radius: 50% !important;
width: avatar-width;
height: avatar-width;
- vertical-align: middle;
}
- info-margin = 20px;
-
&-info {
- display: inline-block;
- margin-left: info-margin;
- padding-top: .6rem;
- width: 'calc(100% - %s)' % (avatar-width + info-margin);
- height: 100%;
- vertical-align: middle;
+ overflow: hidden;
+ width: 100%;
color: var(--color-gray-800);
&__name,
@@ -46,6 +40,10 @@
text-overflow: ellipsis;
}
+ &__name {
+ font-weight: $font-weight-bolder;
+ }
+
&__intro {
font-size: .9em;
color: #999;
--
GitLab