From 29f4a671c2e1f91f01ac2998967668d84539c216 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 7 Jul 2021 01:18:13 +0800 Subject: [PATCH] sidebar --- layout/_partial/sidebar/logo.ejs | 11 ++++++- layout/_partial/sidebar/widgets/recent.ejs | 17 +++++++++-- layout/_partial/sidebar/widgets/repo_info.ejs | 2 +- source/css/_layout/sidebar/repo_info.styl | 9 +++--- source/css/_layout/sidebar/sidebar.styl | 29 ++++++++++++++++--- 5 files changed, 55 insertions(+), 13 deletions(-) diff --git a/layout/_partial/sidebar/logo.ejs b/layout/_partial/sidebar/logo.ejs index cce9eb2..8cf8e4c 100644 --- a/layout/_partial/sidebar/logo.ejs +++ b/layout/_partial/sidebar/logo.ejs @@ -40,7 +40,16 @@ function layoutDiv() { } if (md_text(theme.sidebar.logo.title)) { el += ''; - el += md_text(theme.sidebar.logo.title); + el += '
' + md_text(theme.sidebar.logo.title) + '
'; + if (config.subtitle) { + let arr = config.subtitle.split('|'); + if (arr.length > 0) { + el += '
' + arr[0] + '
'; + if (arr.length > 1) { + el += '
' + arr[1] + '
'; + } + } + } el += '
'; } } diff --git a/layout/_partial/sidebar/widgets/recent.ejs b/layout/_partial/sidebar/widgets/recent.ejs index 966a38c..187d94c 100644 --- a/layout/_partial/sidebar/widgets/recent.ejs +++ b/layout/_partial/sidebar/widgets/recent.ejs @@ -22,11 +22,22 @@ function layoutDiv() { el += ''; el += '
'; el += ''; + if (post.layout === 'wiki') { + el += ''; + let proj = theme.wiki.projects[post.wiki]; + if (proj && proj.title) { + el += proj.title; + } else if (post.wiki) { + el += post.wiki; + } + el += ''; + } else { + post.categories.limit(1).forEach((cat, i) => { + el += '' + cat.name + ''; + }); + } el += '
'; el += ''; - if (post.wiki && (post.title.toUpperCase().includes(post.wiki.toUpperCase()) == false)) { - el += post.wiki + ': '; - } el += post.title; el += ''; el += '
'; diff --git a/layout/_partial/sidebar/widgets/repo_info.ejs b/layout/_partial/sidebar/widgets/repo_info.ejs index 9d8df1b..6d5eed1 100644 --- a/layout/_partial/sidebar/widgets/repo_info.ejs +++ b/layout/_partial/sidebar/widgets/repo_info.ejs @@ -53,7 +53,7 @@ function layoutDiv() { el += ' target="_blank" rel="external nofollow noopener noreferrer"'; el += '>'; el += item.icon; - el += item.text; + el += '' + item.text + ''; el += ''; }); el += ''; diff --git a/source/css/_layout/sidebar/repo_info.styl b/source/css/_layout/sidebar/repo_info.styl index cf4c0d0..92e66e7 100644 --- a/source/css/_layout/sidebar/repo_info.styl +++ b/source/css/_layout/sidebar/repo_info.styl @@ -1,18 +1,19 @@ .widget-wrap#repo-info .widget-body .item - margin: .25rem 0 + margin: 4px 0 a color: var(--text-p2) font-weight: 500 display: inline-flex align-items: center - line-height: 1.8 - padding: 0 .5rem + padding: 0.25rem .5rem border-radius: 4px + font-size: $fs-13 svg margin-right: .5rem - width: 1rem + width: 1em + height: 1em a:hover color: var(--text-p1) background: var(--block-hover) diff --git a/source/css/_layout/sidebar/sidebar.styl b/source/css/_layout/sidebar/sidebar.styl index 040556c..eb32330 100644 --- a/source/css/_layout/sidebar/sidebar.styl +++ b/source/css/_layout/sidebar/sidebar.styl @@ -59,12 +59,30 @@ animation: spin infinite 1s animation-timing-function: linear - .title + a.title font-size: 1.75rem font-weight: 900 color: inherit - line-height: 1; + line-height: 1 font-family: $ff-logo + display: block + position: relative + .sub + color: var(--text-p1) + trans2 opacity transform + .hover + position: absolute + bottom: 0 + transform: translateY(8px) + &:hover + .normal + opacity: 0 + transform: translateY(-8px) + .hover + transform: translateY(0) + opacity: 1 !important + a.avatar+a.title + txt-ellipsis() .logo-wrap.wiki @@ -72,14 +90,15 @@ flex-direction: column align-items: flex-start a.wiki-home - margin-bottom: .75rem + margin-bottom: .5rem color: var(--text-p2) svg margin-right: 2px &:hover color: $color-hover filter: unset !important - + a.title + line-height: inherit nav.menu margin: 1rem 0 .5rem @@ -174,6 +193,8 @@ nav.menu div.cap margin-bottom: 0.25rem color: var(--text-p4) + display: flex + justify-content: space-between &:hover color: $color-hover background: var(--card)