-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the profile sidebar module (#379)
- Loading branch information
Showing
6 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
modules/sidebar/profile/assets/hb/modules/blog-sidebar-profile/scss/index.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.hb-blog-sidebar-profile-img { | ||
height: #{$hb-blog-sidebar-profile-avatar-size}px; | ||
width: #{$hb-blog-sidebar-profile-avatar-size}px; | ||
} |
2 changes: 2 additions & 0 deletions
2
modules/sidebar/profile/assets/hb/modules/blog-sidebar-profile/scss/variables.tmpl.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{- $params := site.Params.hb.blog.sidebar.profile }} | ||
$hb-blog-sidebar-profile-avatar-size: {{ default 100 $params.avatar_size }}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/hbstack/blog/modules/sidebar/profile | ||
|
||
go 1.19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[[module.imports]] | ||
path = "github.com/hbstack/blog" | ||
|
||
[[module.imports]] | ||
path = "github.com/hbstack/socials" | ||
|
||
[[module.imports]] | ||
path = "github.com/hugomods/icons/vendors/bootstrap" | ||
|
||
[params.hugopress.modules.hb-blog-sidebar-profile.hooks.hb-blog-sidebar] | ||
cacheable = true | ||
weight = 1 | ||
|
||
[params.hb.blog.sidebar.profile] | ||
avatar = "/images/logo.png" | ||
avatar_size = 100 | ||
title = "" # default to site title. | ||
description = "" # default to site description. | ||
company = "" | ||
location = "" |
52 changes: 52 additions & 0 deletions
52
...ile/layouts/partials/hugopress/modules/hb-blog-sidebar-profile/hooks/hb-blog-sidebar.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{{- 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"> | ||
{{- $avatarSize := default 100 .avatar_size }} | ||
{{- with .avatar }} | ||
{{ partial "images/image" (dict | ||
"Filename" (printf "%s?height=%d&width=%d" . $avatarSize) | ||
"ClassName" "hb-blog-sidebar-profile-img rounded-circle img-fluid mb-3") | ||
}} | ||
{{- end }} | ||
<p class="hb-blog-sidebar-profile-title h5 mb-3"> | ||
{{ default site.Title .title | markdownify }} | ||
</p> | ||
<p class="hb-blog-sidebar-profile-desc text-center mb-2"> | ||
{{ default site.Params.description .description | markdownify }} | ||
</p> | ||
<p class="hb-blog-sidebar-profile-meta mb-1"> | ||
{{- with .company }} | ||
<span class="mx-1"> | ||
{{- partial "icons/icon" (dict "vendor" "bootstrap" "name" "building" "className" "me-1") -}} | ||
{{- . | markdownify -}} | ||
</span> | ||
{{- end }} | ||
{{- with .location }} | ||
<span class="mx-1"> | ||
{{- partial "icons/icon" (dict "vendor" "bootstrap" "name" "geo-alt" "className" "me-1") -}} | ||
{{- . | markdownify -}} | ||
</span> | ||
{{- end }} | ||
</p> | ||
{{- with .socials }} | ||
{{- $color := default true ._color }} | ||
<div class="hb-footer-socials d-flex mb-2 justify-content-center"> | ||
{{- range $name, $id := . }} | ||
{{/* ignore options. */}} | ||
{{- if hasPrefix $name "_" }} | ||
{{- continue }} | ||
{{- end }} | ||
{{- $ctx := dict | ||
"id" $id | ||
"name" $name | ||
"class" "p-2" | ||
"width" "1.75em" | ||
"height" "1.75em" | ||
"color" $color | ||
}} | ||
{{ partial "hb/modules/socials/link" $ctx }} | ||
{{- end }} | ||
</div> | ||
{{- end }} | ||
</div> | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters