💄 Optimize comment components display style.

This commit is contained in:
凡梦星尘 2022-06-20 09:52:23 +08:00
parent f0ae834374
commit fae6b4787c
4 changed files with 33 additions and 8 deletions

View File

@ -53,6 +53,9 @@
vertical-align: middle; vertical-align: middle;
font-weight: 700; font-weight: 700;
font-size: 1.4em; font-size: 1.4em;
@include mobile-small() {
font-size: $font-size-smaller;
}
} }
@if $two_comments_enable { @if $two_comments_enable {
@ -61,6 +64,10 @@
float: right; float: right;
margin: 2px auto; margin: 2px auto;
padding: 4px 16px; padding: 4px 16px;
@include mobile-small() {
font-size: $font-size-smaller;
padding: 4px;
}
width: max-content; width: max-content;
border-radius: 8px; border-radius: 8px;
background: #eee; background: #eee;
@ -83,7 +90,7 @@
.switch-btn { .switch-btn {
position: relative; position: relative;
display: inline-block; display: inline-block;
margin: -4px 8px 0; margin: 5px;
width: 42px; width: 42px;
height: 22px; height: 22px;
border-radius: 34px; border-radius: 34px;
@ -147,6 +154,11 @@
$second_comment_display: block; $second_comment_display: block;
} }
.comment-wrap .storage {
display: block;
animation: 0.5s ease 0s 1 normal none running tabshow;
}
.comment-wrap>div:nth-child(1) { .comment-wrap>div:nth-child(1) {
display: $first_comment_display; display: $first_comment_display;
} }

View File

@ -50,6 +50,7 @@ NexT.boot.refresh = function() {
NexT.utils.registerLangSelect();*/ NexT.utils.registerLangSelect();*/
NexT.utils.registerSidebarTOC(); NexT.utils.registerSidebarTOC();
NexT.utils.registerPostReward(); NexT.utils.registerPostReward();
NexT.utils.initCommontesDispaly();
NexT.utils.registerCommonSwitch(); NexT.utils.registerCommonSwitch();
NexT.utils.wrapTableWithBox(); NexT.utils.wrapTableWithBox();
NexT.utils.registerVideoIframe(); NexT.utils.registerVideoIframe();

View File

@ -243,18 +243,30 @@ NexT.utils = {
}); });
}, },
initCommontesDispaly: function(){
const comms = document.querySelectorAll('.comment-wrap > div');
if (comms.length<=1) return;
comms.forEach(function(item){
var dis = window.getComputedStyle(item, null).display;
item.style.display = dis;
});
},
registerCommonSwitch: function() { registerCommonSwitch: function() {
const button = document.querySelector('.comment-switch .switch-btn'); const button = document.querySelector('.comment-switch .switch-btn');
if (!button) return; if (!button) return;
const cwrap = document.querySelector('.comment-wrap'); const comms = document.querySelectorAll('.comment-wrap > div');
button.addEventListener('click', () => { button.addEventListener('click', () => {
button.classList.toggle('move'); button.classList.toggle('move');
const comms = document.querySelectorAll('.comment-wrap > div'); comms.forEach(function(item){
let len = comms.length; item.style.display = item.style.display === 'none' ? 'block' : 'none';
while(len--){ if (item.style.display === 'block') {
cwrap.appendChild(comms[len]); item.style.animation = "0.8s ease 0s 1 normal none running tabshow";
} else {
item.style.removeProperty('animation');
} }
}); });
});
}, },
activateNavByIndex: function(index) { activateNavByIndex: function(index) {

View File

@ -1,6 +1,6 @@
{{- with .Site.Params.utterances }} {{- with .Site.Params.utterances }}
{{- if .enable }} {{- if .enable }}
<script src="//utteranc.es/client.js" <script src="https://utteranc.es/client.js"
repo="{{ .repo }}" repo="{{ .repo }}"
issue-term="{{ .issueTerm }}" issue-term="{{ .issueTerm }}"
label="{{ .label }}" label="{{ .label }}"