Optimize the style of label tag

This commit is contained in:
Mimi 2020-06-07 11:30:08 +08:00
parent d194052d7e
commit 8e080e7e27
5 changed files with 6 additions and 27 deletions

View File

@ -13,7 +13,7 @@ function postLabel(args) {
!text && hexo.log.warn('Label text must be defined!'); !text && hexo.log.warn('Label text must be defined!');
return `<span class="label ${classes.trim()}">${text}</span>`; return `<mark class="label ${classes.trim()}">${text}</mark>`;
} }
hexo.extend.tag.register('label', postLabel, {ends: false}); hexo.extend.tag.register('label', postLabel, {ends: false});

View File

@ -22,12 +22,10 @@
&::before { &::before {
content: ' ('; content: ' (';
display: inline;
} }
&::after { &::after {
content: ') '; content: ') ';
display: inline;
} }
} }

View File

@ -1,29 +1,10 @@
.post-body .label { .post-body .label {
color: $text-color; color: $text-color;
display: inline;
padding: 0 2px; padding: 0 2px;
&.default { for $type in $note-types {
background: $label-default; &.{$type} {
} background: lookup('$label-' + $type);
}
&.primary {
background: $label-primary;
}
&.info {
background: $label-info;
}
&.success {
background: $label-success;
}
&.warning {
background: $label-warning;
}
&.danger {
background: $label-danger;
} }
} }

View File

@ -1,7 +1,6 @@
.post-body .note { .post-body .note {
$note-icons = hexo-config('note.icons'); $note-icons = hexo-config('note.icons');
$note-style = hexo-config('note.style'); $note-style = hexo-config('note.style');
$note-types = 'default' 'primary' 'info' 'success' 'warning' 'danger';
border-radius: $note-border-radius; border-radius: $note-border-radius;
margin-bottom: 20px; margin-bottom: 20px;

View File

@ -278,6 +278,7 @@ $post-eof-margin-bottom = 60px; // or 120px for less white space;
// -------------------------------------------------- // --------------------------------------------------
// Read note light_bg_offset from NexT config and set in "$lbg%" to use it as string variable. // Read note light_bg_offset from NexT config and set in "$lbg%" to use it as string variable.
$lbg = hexo-config('note.light_bg_offset') is a 'unit' ? unit(hexo-config('note.light_bg_offset'), "%") : 0; $lbg = hexo-config('note.light_bg_offset') is a 'unit' ? unit(hexo-config('note.light_bg_offset'), "%") : 0;
$note-types = 'default' 'primary' 'info' 'success' 'warning' 'danger';
// Default // Default
$note-border-radius = 3px; $note-border-radius = 3px;