From c5bb1c94c5357043ceb4d87cf431cbaddff10dea Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Thu, 1 Feb 2024 21:27:34 +0800 Subject: [PATCH] [opt] style --- _data/icons.yml | 2 ++ layout/_partial/main/navbar/dateinfo.ejs | 3 +++ layout/_partial/main/post_list/post_card.ejs | 5 ++-- layout/_partial/widgets/related.ejs | 2 +- layout/categories.ejs | 2 +- source/css/_layout/list.styl | 24 ++++++++++++-------- source/css/_layout/pages/archives.styl | 8 +++++++ source/css/_layout/partial/navbar.styl | 2 +- 8 files changed, 34 insertions(+), 14 deletions(-) diff --git a/_data/icons.yml b/_data/icons.yml index 2ac9317..7ff7518 100644 --- a/_data/icons.yml +++ b/_data/icons.yml @@ -20,6 +20,8 @@ default:bookmark.active: default:pin: +default:calendar: +default:category: github:logo: github:repo: diff --git a/layout/_partial/main/navbar/dateinfo.ejs b/layout/_partial/main/navbar/dateinfo.ejs index c6845f3..47c143c 100644 --- a/layout/_partial/main/navbar/dateinfo.ejs +++ b/layout/_partial/main/navbar/dateinfo.ejs @@ -15,6 +15,9 @@ function layoutDiv() { } // 发布日期 el += `` + if (!author) { + el += `${__("meta.created") + __("symbol.colon")}` + } el += `` el += `` // 更新日期 diff --git a/layout/_partial/main/post_list/post_card.ejs b/layout/_partial/main/post_list/post_card.ejs index cd4c3f9..8ab9c2c 100755 --- a/layout/_partial/main/post_list/post_card.ejs +++ b/layout/_partial/main/post_list/post_card.ejs @@ -69,7 +69,7 @@ function div_default() { // meta el += '
'; el += ''; - + el += icon('default:calendar') // time el += `` el += ''; @@ -85,7 +85,8 @@ function div_default() { if (cats.length > 0) { let cat = cats.shift(); el += ''; - el += cat; + el += icon('default:category') + el += `${cat}` el += ''; } } diff --git a/layout/_partial/widgets/related.ejs b/layout/_partial/widgets/related.ejs index c589afb..3e344a3 100644 --- a/layout/_partial/widgets/related.ejs +++ b/layout/_partial/widgets/related.ejs @@ -10,7 +10,7 @@ function relatedPostsInTopic() { var el = '' el += `` el += `
` - el += `${__('btn.topic') + __('symbol.colon') + topic.name}` + el += `${__('btn.topic') + __('symbol.colon') + (topic.name || topic.title)}` el += `
` el += `
` for (let post of topic.pages) { diff --git a/layout/categories.ejs b/layout/categories.ejs index 4a911e5..d97c12f 100755 --- a/layout/categories.ejs +++ b/layout/categories.ejs @@ -13,7 +13,7 @@ if (page.menu_id == undefined) { <% site.categories.sort('path').each(function(category){ %>
- <%- category.name %> + <%- icon('default:category') %><%- category.name %> (<%- category.posts.length %>)
diff --git a/source/css/_layout/list.styl b/source/css/_layout/list.styl index 3f2fad3..1c3409c 100644 --- a/source/css/_layout/list.styl +++ b/source/css/_layout/list.styl @@ -46,20 +46,26 @@ margin: 0.5rem 0 line-height: 1.5 .meta.cap - display: flex + &,span + display: flex + align-items: center flex-wrap: wrap - align-items: center - margin: 0.25rem 0 - line-height: 1.5 - span+span - margin-left: 0.5rem - span.pin + margin: 0 + line-height: 2 + --fsp: var(--fsp1) + font-size: var(--fsp) + svg + height: 1em + width: auto line-height: 0 + transform: scale(1.2) + margin-right: 8px + >span+span + margin-left: 1.5rem + span.pin img object-fit: contain - height: 1.5em svg - height: 1.5rem color: $c-red .post-list.post .post-card:hover diff --git a/source/css/_layout/pages/archives.styl b/source/css/_layout/pages/archives.styl index eb8374d..9985149 100644 --- a/source/css/_layout/pages/archives.styl +++ b/source/css/_layout/pages/archives.styl @@ -53,6 +53,14 @@ justify-content: space-between font-weight: 500 font-size: $fs-14 + span + display: flex + align-items: center + svg + height: 1em + width: auto + transform: scale(1.2) + margin-right: 8px .badge font-weight: 700 font-family: $ff-code diff --git a/source/css/_layout/partial/navbar.styl b/source/css/_layout/partial/navbar.styl index f616ff3..765633f 100644 --- a/source/css/_layout/partial/navbar.styl +++ b/source/css/_layout/partial/navbar.styl @@ -29,7 +29,7 @@ nav.sub >p margin: 0 a - padding: .25rem 0.75rem + padding: 2px 0.75rem if hexo-config('style.site') && hexo-config('style.site.background-image') margin: 10px 0.25rem 8px 0 else