From 3f492952d869da850f8fb2e7bd60d7e7e86da38c Mon Sep 17 00:00:00 2001 From: lensferno Date: Tue, 27 Jun 2023 17:29:27 +0800 Subject: [PATCH] theme --- layout/includes/_partials/button.pug | 2 +- layout/includes/_partials/header.pug | 2 +- .../_partials/post_list/paginator.pug | 18 ++++++++++ .../_partials/post_list/post_list.pug | 6 ++-- source/css/_partials/index.styl | 3 +- source/css/_partials/post_list/paginator.styl | 36 +++++++++++++++++++ source/css/_partials/post_list/post_item.styl | 2 +- source/css/common.styl | 2 +- 8 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 layout/includes/_partials/post_list/paginator.pug create mode 100644 source/css/_partials/post_list/paginator.styl diff --git a/layout/includes/_partials/button.pug b/layout/includes/_partials/button.pug index 38252c1..1aac0f5 100644 --- a/layout/includes/_partials/button.pug +++ b/layout/includes/_partials/button.pug @@ -1,4 +1,4 @@ -mixin button (target_href, active, text) +mixin button_menu (target_href, active, text) .button-component .button-container a.button-anchor( diff --git a/layout/includes/_partials/header.pug b/layout/includes/_partials/header.pug index 1768ed9..e750740 100644 --- a/layout/includes/_partials/header.pug +++ b/layout/includes/_partials/header.pug @@ -7,4 +7,4 @@ include ./button.pug - var targetPath = target.substr(1) - var currPath = page.path - var active = (!is_home() && targetPath === '') ? false : currPath.startsWith(targetPath) - +button(target, active, name) + +button_menu(target, active, name) diff --git a/layout/includes/_partials/post_list/paginator.pug b/layout/includes/_partials/post_list/paginator.pug new file mode 100644 index 0000000..aef722d --- /dev/null +++ b/layout/includes/_partials/post_list/paginator.pug @@ -0,0 +1,18 @@ +mixin paginator_button(prev, disabled, link) + .paginator-button-component + a.button-anchor( + href= disabled ? undefined : link + class= disabled ? 'disabled' : '' + ) + span.button-text + = prev ? '<' : '>' + +.paginator + .left + span= page.current + ' / ' + page.total + .right + .paginator-btn-box + - const is_first = page.prev == 0 + - const is_last = page.next == 0 + +paginator_button(true, is_first, url_for(page.prev_link)) + +paginator_button(false, is_last, url_for(page.next_link)) \ No newline at end of file diff --git a/layout/includes/_partials/post_list/post_list.pug b/layout/includes/_partials/post_list/post_list.pug index 6552cb5..b54055b 100644 --- a/layout/includes/_partials/post_list/post_list.pug +++ b/layout/includes/_partials/post_list/post_list.pug @@ -15,5 +15,7 @@ include post_item.pug - const content = (post.more !== undefined) ? post.more : post.content - const strip = strip_html(content).substr(0, MAX_SUMMARY_LENGTH) - summary = strip.length < MAX_SUMMARY_LENGTH ? strip : strip + '...' - +post_item(post.title, post.cover, post_date, trim(summary), post_time, url_for(post.path)) - - }) \ No newline at end of file + +post_item(post.title, post.cover, post_date, trim(summary), post_time, post.path) + - }) + + include paginator.pug \ No newline at end of file diff --git a/source/css/_partials/index.styl b/source/css/_partials/index.styl index 3a3ad68..efcbfe8 100644 --- a/source/css/_partials/index.styl +++ b/source/css/_partials/index.styl @@ -16,7 +16,8 @@ width: 100% // overflow-y: scroll overflow-x: hidden - + justify-content: space-between + .right-content width: 24% position: sticky diff --git a/source/css/_partials/post_list/paginator.styl b/source/css/_partials/post_list/paginator.styl new file mode 100644 index 0000000..3509a5e --- /dev/null +++ b/source/css/_partials/post_list/paginator.styl @@ -0,0 +1,36 @@ +.paginator + display: flex + flex-direction: row + justify-content: space-between + align-items: center + padding: 10px 10px + user-select: none + .left + font-size: 18px + font-weight: bold + .right + .paginator-btn-box + display: flex + flex-direction: row + justify-content: center + gap: 24px + .paginator-button-component + .button-anchor + width: 64px + height: 32px + display: flex + align-items: center + justify-content: center + text-decoration: none + font-size: 20px + transition: all 0.2s linear 0s + background-color: rgb(180, 175, 154) + color: rgb(74, 71, 62) + cursor: default + &:hover:not(.disabled) + background-color: rgb(74, 71, 62) + color: $light + .button-anchor.disabled + background-color: rgb(200, 195, 174) + color: rgb(91, 91, 82) + cursor: not-allowed diff --git a/source/css/_partials/post_list/post_item.styl b/source/css/_partials/post_list/post_item.styl index f89bee9..aef6875 100644 --- a/source/css/_partials/post_list/post_item.styl +++ b/source/css/_partials/post_list/post_item.styl @@ -8,7 +8,7 @@ transition: all 0.2s linear 0s padding: 8px 8px margin: 4px 4px - min-height: 128px; + min-height: 144px; &:hover background-color: $light .no-cover diff --git a/source/css/common.styl b/source/css/common.styl index 2346a5d..fdf7b32 100644 --- a/source/css/common.styl +++ b/source/css/common.styl @@ -46,7 +46,7 @@ span::selection &::-webkit-scrollbar-button border-radius: 10px; border-spacing: 10px; - background-color: rgb(74 71 62); + background-color: rgb(74, 71, 62); width: 10px; height: 10px; &::-webkit-scrollbar-corner