Skip to content

Commit

Permalink
feat: add avatar to author name
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud authored and Jatin794 committed Dec 19, 2024
1 parent cceb619 commit 1100152
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 6 deletions.
82 changes: 82 additions & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ ul {
--tw-backdrop-sepia: ;
}

.tw-m-1 {
margin: 0.25rem;
}

.tw-m-4 {
margin: 1rem;
}

.tw-my-4 {
margin-top: 1rem;
margin-bottom: 1rem;
Expand All @@ -584,6 +592,80 @@ ul {
margin-right: 0.25rem;
}

.tw-ml-4 {
margin-left: 1rem;
}

.tw-block {
display: block;
}

.tw-inline-block {
display: inline-block;
}

.tw-flex {
display: flex;
}

.tw-max-h-4 {
max-height: 1rem;
}

.tw-max-h-8 {
max-height: 2rem;
}

.tw-max-h-16 {
max-height: 4rem;
}

.tw-max-h-12 {
max-height: 3rem;
}

.tw-max-h-6 {
max-height: 1.5rem;
}

.tw-translate-y-1 {
--tw-translate-y: 0.25rem;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.tw-translate-y-\[-1\] {
--tw-translate-y: -1;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.tw-translate-y-\[-2\] {
--tw-translate-y: -2;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.tw-translate-y-\[-3\] {
--tw-translate-y: -3;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.tw-translate-y-\[-1px\] {
--tw-translate-y: -1px;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.tw-translate-y-\[-2px\] {
--tw-translate-y: -2px;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.tw-items-center {
align-items: center;
}

.tw-rounded-full {
border-radius: 9999px;
}

.tw-border-t-2 {
border-top-width: 2px;
}
Expand Down
5 changes: 3 additions & 2 deletions themes/DoIt/layouts/partials/meta/author.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{{- if .Params.authors -}}
{{- $lang := ( $.Params.lang | default $.Lang ) -}}
<span class='author'>
{{- partial "plugin/icon.html" $icon -}}
<span class='screen-reader-text'> {{ i18n "by" }} </span>
{{- range $i, $name := .Params.authors -}}
{{- if $.Site.Data.authors -}}
Expand All @@ -12,7 +11,9 @@
"lang" $lang
) -}}
{{- if gt $i 0 }}, {{ end -}}
<a href='{{ .link | absURL }}'>{{- .name -}}</a>
<a href='{{ .link | absURL }}'><img src='{{ .avatar | absURL }}' alt='{{ .name }} avatar' class="tw-inline-block tw-max-h-4 tw-rounded-full tw-translate-y-[-2px] tw-mr-1"/>
{{- .name -}}
</a>
{{- end -}}
{{- else -}}
{{- with partial "function/author.html" (dict
Expand Down
4 changes: 1 addition & 3 deletions themes/DoIt/layouts/taxonomy/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ <h2 class="single-title animate__animated animate__pulse animate__faster">
{{- else if eq $taxonomy "tag" -}}
<i class="fas fa-tag fa-fw"></i>&nbsp;{{ .Title }}
{{- else if eq $taxonomy "author" -}}
{{- $icon := dict "Class" "author fas fa-user fa-fw" }}
{{- partial "plugin/icon.html" $icon -}}

{{- .Scratch.Set "name" .Title -}}
{{- if $.Site.Data.authors -}}
{{- with partial "function/author.html" (dict "name" .Title "author" (index $.Site.Data.authors .Title) "lang" ($.Params.lang | default $.Lang)) -}}
{{- .name | safeHTML -}}
<img src='{{ .avatar | absURL }}' alt='{{ .name }} avatar' class="tw-inline-block tw-max-h-8 tw-rounded-full tw-translate-y-[-2px] tw-ml-4"/>
<br>
{{- if .absLink -}}
<a class="author-link-icon" href="{{ .absLink }}" title="Link" rel="icon noopener noreferrer" target="_blank">
Expand Down
2 changes: 1 addition & 1 deletion themes/DoIt/layouts/taxonomy/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h3 class="card-item-title">
<div class="card-item-wrapper">
<h3 class="card-item-title">
<a href="{{ .RelPermalink }}">
<i class="fas fa-user-circle fa-fw"></i>&nbsp;{{ .Page.Title }} <sup>{{- len $pages -}}</sup>
&nbsp;{{ .Page.Title }} <sup>{{- len $pages -}}</sup>
</a>
</h3>
{{- range first 5 $pages -}}
Expand Down

0 comments on commit 1100152

Please sign in to comment.