Skip to content

Commit

Permalink
feat: prepare for theming
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Oct 16, 2023
1 parent 16a9605 commit fd8d330
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 39 deletions.
15 changes: 15 additions & 0 deletions assets/hb/modules/blog/scss/_authors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.hb-blog-term-profile,
.hb-blog-term-author {
.hb-social {
color: var(--#{$prefix}body-color);

&:hover {
color: var(--#{$prefix}primary);
}
}
}

.hb-blog-term-img {
height: 100px;
width: 100px;
}
6 changes: 6 additions & 0 deletions assets/hb/modules/blog/scss/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@

@include top-offset(sticky);
}

.hb-module {
&:last-child {
margin-bottom: 0 !important;
}
}
}

.hb-blog-main {
Expand Down
16 changes: 0 additions & 16 deletions assets/hb/modules/blog/scss/_terms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,3 @@ $hb-terms-colors: ($warning, $success, $danger);
}
}
}

.hb-blog-term-profile,
.hb-blog-term-author {
.hb-social {
color: var(--#{$prefix}body-color);

&:hover {
color: var(--#{$prefix}primary);
}
}
}

.hb-blog-term-img {
height: 100px;
width: 100px;
}
1 change: 1 addition & 0 deletions assets/hb/modules/blog/scss/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "archives";
@import "authors";
@import "home";
@import "post";
@import "sidebar";
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/term.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ partial "hb/modules/pagination/index" .Paginator }}
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }}
</div>
<div class="hb-blog-sidebar">
<div class="hb-blog-sidebar pe-lg-1">
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-sidebar" "Page" .) }}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/terms.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- define "main" }}
<div class="row align-items-center flex-grow-1">
<div class="row align-items-center flex-grow-1 hb-module">
<div class="col-6 offset-3">
<h1 class="mb-4 text-center">
<h1 class="mb-4 pb-3 text-center border-bottom">
{{- .Title -}}
<small class="ms-1 text-secondary">({{- len .Data.Pages -}})</small>
</h1>
Expand Down
2 changes: 1 addition & 1 deletion layouts/authors/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1 class="mb-3 text-center h4">
</h1>
<div class="row row-cols-1">
{{- range $i, $page := sort .Data.Pages ".Data.Pages" "desc" }}
<div class="hb-blog-term-author col d-flex mb-3 border-top pt-3">
<div class="hb-blog-term-author hb-module col d-flex border-top pt-3">
{{- $img := partial "hb/modules/blog/author/image" (dict
"Page" .
"Placeholder" false
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hb/modules/blog/archives/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-begin" "Page" .) }}
<div
class="archives border-start border-5 ps-4 pt-3 position-relative hb-module">
class="archives border-start border-5 ps-4 pt-3 position-relative">
{{ partial "hb/modules/blog/archives/posts" .Paginator.Pages }}
<div class="border-1">
{{ partial "hb/modules/pagination/index" .Paginator }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hb/modules/blog/home/taxonomies.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"series" (dict "icon" "layout-text-window-reverse" "className" "text-danger")
}}
{{- $size := "2.25em" }}
<nav class="nav nav-fill mb-5">
<nav class="nav nav-fill hb-module">
<a
class="nav-link d-flex flex-column disabled"
href="{{ site.Home.RelPermalink }}"
Expand Down
6 changes: 4 additions & 2 deletions layouts/partials/hb/modules/blog/post/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{{- $readMore := default true .ReadMore }}
{{- $readingTime := default true .ReadingTime }}
{{- $meta := default true .Meta }}
<div class="hb-blog-post-card hb-module card border-0 overflow-hidden h-100 mb-0">
{{- $modularize := default true .Modularize }}
<div
class="hb-blog-post-card card border-0 overflow-hidden h-100{{ cond $modularize ` hb-module` ` bg-transparent` }} mb-0">
{{- if $meta }}
<div class="hb-blog-post-meta d-flex align-items-center">
{{ partialCached "hb/modules/blog/post/meta/authors" $page $page }}
Expand Down Expand Up @@ -44,7 +46,7 @@
{{- if and $readMore $truncated }}
<div class="mt-2">
<a
class="btn btn-sm btn-outline-secondary" href="{{ .Page.RelPermalink }}">
class="btn btn-sm btn-outline-secondary" href="{{ $page.RelPermalink }}">
{{- "read_more" | i18n -}}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hb/modules/blog/post/comments.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if default true .Params.comments }}
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-comments-begin" "Page" .) }}
<div id="content-comments" class="hb-blog-post-comments mb-5">
<div id="content-comments" class="hb-blog-post-comments mb-3">
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-post-comments" "Page" .) }}
</div>
{{- partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-comments-end" "Page" .) }}
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/hb/modules/blog/posts.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{- $cols := default "row-cols-1 row-cols-lg-2 row-cols-xl-3" .Cols }}
{{- $readMore := default true .ReadMore }}
{{- $modularize := default true .Modularize }}
<div class="hb-blog-posts row {{ $cols }} g-3 mb-3">
{{ range .Pages }}
<div class="col">
{{- $ctx := dict "Page" . "ReadMore" $readMore }}
{{- $ctx := dict "Page" . "ReadMore" $readMore "Modularize" $modularize }}
{{ partial "hb/modules/blog/post/card" $ctx }}
</div>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hb/modules/blog/taxonomies/toggle.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{- $first = false }}
{{- end }}
</ul>
<div class="tab-content mb-4">
<div class="tab-content">
{{- $first := true }}
{{- range $name, $taxonomy := site.Taxonomies }}
{{- if not $taxonomy }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hb/modules/blog/term/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"title" "Types"
"count" (len (.Data.Pages.GroupBy "Type")))
}}
<ul class="nav justify-content-center mb-3">
<ul class="nav justify-content-center mt-3 mb-0">
{{ range $metrics }}
<li
class="nav-item d-flex flex-column justify-content-center align-items-center my-2 mx-3">
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/hb/modules/blog/term/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"Placeholder" false
"ClassName" "hb-blog-term-img img-fluid rounded-circle mb-3")
}}
<h1 class="text-center mb-3 h4">
<h1 class="text-center h4 mb-0 mt-2">
<a class="text-decoration-none" href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>
{{- with .Description }}
<p class="text-body-secondary text-center mb-3">{{ . }}</p>
<p class="text-body-secondary text-center mt-3 mb-0">{{ . }}</p>
{{- end }}
{{- with .Params.socials }}
{{ partial "hb/modules/blog/term/socials" . }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hb/modules/blog/term/socials.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"width" "1.75em"
"color" $color
}}
<li class="nav-item d-flex align-items-center mx-3 mb-3">
<li class="nav-item d-flex align-items-center mx-3 mt-3 mb-0">
{{- partial "hb/modules/socials/link" $ctx }}
</li>
{{ end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- if not .PrevInSection }}
{{- $justify = "justify-content-end" }}
{{- end }}
<ul class="hb-blog-post-nav nav hb-module {{ $justify }}">
<ul class="hb-blog-post-nav nav {{ $justify }} mb-3">
{{ with .PrevInSection }}
<li class="nav-item my-1">
<a class="nav-link p-0 d-flex align-items-center" href="{{ .RelPermalink }}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- with .Site.RegularPages.Related . | first .Site.Params.hb.blog.related_posts.number }}
<div class="hb-blog-related-posts hb-module slide">
<div class="hb-blog-related-posts slide mb-3">
<div class="slide-inner row row-cols-1 row-cols-xl-2 gx-2">
{{- $total := len . }}
{{- range $i, $page := . }}
<div class="slide-item">
{{ partial "hb/modules/blog/post/card" (dict "Page" . "Summary" false "Meta" false) }}
{{ partial "hb/modules/blog/post/card" (dict "Page" . "Summary" false "Meta" false "Modularize" false) }}
</div>
{{- end -}}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.hb-blog-sidebar-posts {
.hb-blog-post-title {
margin-bottom: 0 !important;
padding-bottom: 0 !important;
}

.hb-blog-post-title-link {
font-size: 1rem;
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{- if or $featuredPosts $recentPosts }}
{{- $style := default "pills" $params.style }}
{{- $fill := default true $params.fill }}
<div class="hb-blog-sidebar-posts hb-module mb-0">
<div class="hb-blog-sidebar-posts hb-module">
<ul class="nav nav-{{ $style }}{{ cond $fill ` nav-fill` `` }}" role="tablist">
{{- if $featuredPosts }}
<li class="nav-item" role="presentation">
Expand Down Expand Up @@ -62,7 +62,7 @@
<div class="slide-inner row row-cols-1">
{{- range . }}
<div class="slide-item px-0">
{{- $ctx := dict "Page" . "Meta" false "Summary" false }}
{{- $ctx := dict "Page" . "Meta" false "Summary" false "Modularize" false }}
{{ partial "hb/modules/blog/post/card" $ctx }}
</div>
{{- end }}
Expand All @@ -82,7 +82,7 @@
<div class="slide-inner row row-cols-1">
{{- range . }}
<div class="slide-item px-0">
{{- $ctx := dict "Page" . "Meta" false "Summary" false }}
{{- $ctx := dict "Page" . "Meta" false "Summary" false "Modularize" false }}
{{ partial "hb/modules/blog/post/card" $ctx }}
</div>
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- with site.Params.hb.blog.sidebar.profile }}
<div
class="hb-blog-sidebar-profile hb-module mb-3 d-flex flex-column justify-content-center align-items-center">
class="hb-blog-sidebar-profile hb-module d-flex flex-column justify-content-center align-items-center">
{{- $avatarSize := default 100 .avatar_size }}
{{- with .avatar }}
{{ partial "images/image" (dict
Expand Down Expand Up @@ -30,7 +30,7 @@
</p>
{{- with .socials }}
{{- $color := default true ._color }}
<div class="hb-footer-socials d-flex mb-2 mt-1 justify-content-center">
<div class="hb-footer-socials d-flex mb-0 mt-1 justify-content-center">
{{- range $name, $id := . }}
{{/* ignore options. */}}
{{- if hasPrefix $name "_" }}
Expand Down

0 comments on commit fd8d330

Please sign in to comment.