Cleaned up post list component

This commit is contained in:
Sodbileg Gansukh 2023-08-16 14:48:18 +08:00
parent 06d844910a
commit 6957063474
10 changed files with 74 additions and 145 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -294,6 +294,10 @@ button.gh-form-input {
padding: 0 max(4vmin, 20px);
}
.gh-outer .gh-outer {
padding: 0;
}
.gh-inner {
margin: 0 auto;
max-width: var(--container-width);

View File

@ -36,37 +36,6 @@
</section>
{{/author}}
<section class="gh-container is-{{#match @custom.post_feed_style "List"}}list{{else}}grid{{/match}}{{#if @custom.show_sidebar}} has-sidebar{{/if}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}}">
<div class="gh-container-inner gh-inner">
<main class="gh-main">
<div class="gh-feed">
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
</div>
</main>
{{#if @custom.show_sidebar}}
<aside class="gh-sidebar">
<section class="gh-about">
{{#if @site.icon}}
<img class="gh-about-icon" src="{{@site.icon}}" alt="{{@site.title}}">
{{/if}}
<h3 class="gh-about-title is-title">{{@site.title}}</h3>
{{#if @site.description}}
<p class="gh-about-description is-body">{{@site.description}}</p>
{{/if}}
{{#if @site.members_enabled}}
{{#unless @member}}
<button class="gh-button">Subscribe</button>
{{/unless}}
{{/if}}
</section>
</aside>
{{/if}}
</div>
</section>
{{> "components/post-list" feed="archive" postFeedStyle=@custom.post_feed_style showTitle=false showSidebar=@custom.show_sidebar}}
</main>

View File

@ -7,8 +7,6 @@
{{> "components/featured" showFeatured=@custom.highlight_featured_posts limit=4}}
{{/match}}
{{> "components/cta"}}
{{> "components/post-list" postListStyle=@custom.post_feed_style}}
{{> "components/post-list" feed="home" postFeedStyle=@custom.post_feed_style showTitle=true showSidebar=@custom.show_sidebar}}

View File

@ -1,48 +1,6 @@
{{!< default}}
{{!-- The tag above means: insert everything in this file into the body of the default.hbs template --}}
<main class="gh-main gh-outer">
<section class="gh-container is-{{#match @custom.post_feed_style "List"}}list{{else}}grid{{/match}}{{#if @custom.show_sidebar}} has-sidebar{{/if}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}}">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">Latest</h2>
<main class="gh-main">
<div class="gh-feed">
{{#match pagination.page 2}}
{{#get "posts" include="authors" limit=@config.posts_per_page as |recent|}}
{{#foreach recent}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
{{/match}}
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
</div>
</main>
{{#if @custom.show_sidebar}}
<aside class="gh-sidebar">
<section class="gh-about">
{{#if @site.icon}}
<img class="gh-about-icon" src="{{@site.icon}}" alt="{{@site.title}}">
{{/if}}
<h3 class="gh-about-title is-title">{{@site.title}}</h3>
{{#if @site.description}}
<p class="gh-about-description is-body">{{@site.description}}</p>
{{/if}}
{{#if @site.members_enabled}}
{{#unless @member}}
<button class="gh-button">Subscribe</button>
{{/unless}}
{{/if}}
</section>
</aside>
{{/if}}
</div>
</section>
{{> "components/post-list" feed="index" postFeedStyle=@custom.post_feed_style showTitle=true showSidebar=@custom.show_sidebar}}
</main>

View File

@ -1,10 +1,24 @@
<section class="gh-container is-{{#match @custom.post_feed_style "List"}}list{{else}}grid{{/match}}{{#if @custom.show_sidebar}} has-sidebar{{/if}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}} gh-outer">
{{!--
Parameters:
* feed (index, home, archive, recent)
* postFeedStyle (list, grid)
* showTitle (true, false)
* showSidebar (true, false)
--}}
<section class="gh-container is-{{#match postFeedStyle "List"}}list{{else}}grid{{/match}}{{#if showSidebar}} has-sidebar{{/if}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}} gh-outer">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">Latest</h2>
{{#if showTitle}}
<h2 class="gh-container-title">
{{#unless title}}Latest{{else}}{{title}}{{/unless}}
</h2>
{{/if}}
<main class="gh-main">
<div class="gh-feed">
{{#match feed "home"}}
{{#match @custom.header_style "Highlight"}}
{{#match posts.length ">=" 10}}
{{#foreach posts from="11" limit="9"}}
@ -30,10 +44,39 @@
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{/match}}
{{#match feed "index"}}
{{#match pagination.page 2}}
{{#get "posts" include="authors" limit=@config.posts_per_page as |recent|}}
{{#foreach recent}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
{{/match}}
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{#match feed "archive"}}
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{#match feed "recent"}}
{{#get "posts" include="authors" filter="id:-{{post.id}}" limit="4" as |next|}}
{{#foreach next}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
{{/match}}
</div>
</main>
{{#if @custom.show_sidebar}}
{{#if showSidebar}}
<aside class="gh-sidebar">
<section class="gh-about">
{{#if @site.icon}}

View File

@ -1,12 +0,0 @@
<section class="gh-container is-{{#match @custom.post_feed_style "List"}}grid{{else}}grid{{/match}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}} gh-outer">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">Read more</h2>
<div class="gh-feed">
{{#get "posts" include="authors" filter="id:-{{post.id}}" limit="4" as |next|}}
{{#foreach next}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
</div>
</div>
</section>

View File

@ -60,4 +60,4 @@
{{/post}}
{{> "recent-posts"}}
{{> "components/post-list" feed="recent" postFeedStyle="Grid" title="Read more" showTitle=true showSidebar=false}}

33
tag.hbs
View File

@ -15,37 +15,6 @@
</section>
{{/tag}}
<section class="gh-container is-{{#match @custom.post_feed_style "List"}}list{{else}}grid{{/match}}{{#if @custom.show_sidebar}} has-sidebar{{/if}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}}">
<div class="gh-container-inner gh-inner">
<main class="gh-main">
<div class="gh-feed">
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
</div>
</main>
{{#if @custom.show_sidebar}}
<aside class="gh-sidebar">
<section class="gh-about">
{{#if @site.icon}}
<img class="gh-about-icon" src="{{@site.icon}}" alt="{{@site.title}}">
{{/if}}
<h3 class="gh-about-title is-title">{{@site.title}}</h3>
{{#if @site.description}}
<p class="gh-about-description is-body">{{@site.description}}</p>
{{/if}}
{{#if @site.members_enabled}}
{{#unless @member}}
<button class="gh-button">Subscribe</button>
{{/unless}}
{{/if}}
</section>
</aside>
{{/if}}
</div>
</section>
{{> "components/post-list" feed="archive" postFeedStyle=@custom.post_feed_style showTitle=false showSidebar=@custom.show_sidebar}}
</main>