Skip to content

Commit

Permalink
feat(icon): Workaround for fontawesome 6
Browse files Browse the repository at this point in the history
Signed-off-by: Khusika Dhamar Gusti <[email protected]>
  • Loading branch information
khusika committed Sep 12, 2023
1 parent 5f295f6 commit d271e09
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 143 deletions.
132 changes: 70 additions & 62 deletions assets/data/social.yml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class Theme {
footer: ({}) => {
const { searchType, icon, href } = searchConfig.type === 'algolia' ? {
searchType: 'algolia',
icon: '<i class="fab fa-algolia fa-fw"></i>',
icon: '<i class="fa-brands fa-algolia fa-fw"></i>',
href: 'https://www.algolia.com/',
} : {
searchType: 'Lunr.js',
Expand Down Expand Up @@ -344,20 +344,20 @@ class Theme {
$header.className = 'code-header ' + $code.className.toLowerCase();
const $title = document.createElement('span');
$title.classList.add('code-title');
$title.insertAdjacentHTML('afterbegin', '<i class="arrow fas fa-chevron-right fa-fw"></i>');
$title.insertAdjacentHTML('afterbegin', '<i class="arrow fa-solid fa-chevron-right fa-fw"></i>');
$title.addEventListener('click', () => {
$chroma.classList.toggle('open');
}, false);
$header.appendChild($title);
const $ellipses = document.createElement('span');
$ellipses.insertAdjacentHTML('afterbegin', '<i class="fas fa-ellipsis-h fa-fw"></i>');
$ellipses.insertAdjacentHTML('afterbegin', '<i class="fa-solid fa-ellipsis-h fa-fw"></i>');
$ellipses.classList.add('ellipses');
$ellipses.addEventListener('click', () => {
$chroma.classList.add('open');
}, false);
$header.appendChild($ellipses);
const $copy = document.createElement('span');
$copy.insertAdjacentHTML('afterbegin', '<i class="far fa-copy fa-fw"></i>');
$copy.insertAdjacentHTML('afterbegin', '<i class="fa-regular fa-copy fa-fw"></i>');
$copy.classList.add('copy');
const code = $code.innerText;
if (this.config.code.maxShownLines < 0 || code.split('\n').length < this.config.code.maxShownLines + 2) $chroma.classList.add('open');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ Please open the code block below to view the complete sample configuration :(far
[params.social]
GitHub = "xxxx"
Linkedin = ""
Twitter = "xxxx"
X = "xxxx"
Instagram = "xxxx"
Facebook = "xxxx"
Telegram = "xxxx"
Expand Down Expand Up @@ -463,6 +463,7 @@ Please open the code block below to view the complete sample configuration :(far
Resume = "" #goo.gl id {{< version 1.0.0 >}}
xda = "" {{< version 1.0.2 >}}
RSS = true # {{< version 0.2.0 >}}
discord = "" {{< version 1.0.2 >}}

# {{< version 0.2.0 changed >}} Page config
[params.page]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ Please open the code block below to view the complete sample configuration :(far
[params.social]
GitHub = "xxxx"
Linkedin = ""
Twitter = "xxxx"
X = "xxxx"
Instagram = "xxxx"
Facebook = "xxxx"
Telegram = "xxxx"
Expand Down Expand Up @@ -468,6 +468,7 @@ Please open the code block below to view the complete sample configuration :(far
Resume = "" #goo.gl id {{< version 1.0.0 >}}
xda = "" {{< version 1.0.2 >}}
RSS = true # {{< version 0.2.0 >}}
discord = "" {{< version 1.0.2 >}}

# {{< version 0.2.0 changed >}} Page config
[params.page]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ hugo
# 作者的社交信息设置
[params.social]
GitHub = "xxxx"
Linkedin = ""
X = ""
Twitter = "xxxx"
Instagram = "xxxx"
Facebook = "xxxx"
Expand Down Expand Up @@ -467,6 +467,7 @@ hugo
Resume = "" #goo.gl id {{< version 1.0.0 >}}
xda = "" {{< version 1.0.2 >}}
RSS = true # {{< version 0.2.0 >}}
discord = "" {{< version 1.0.2 >}}

# {{< version 0.2.0 changed >}} 文章页面配置
[params.page]
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ ignoreErrors = ["err-missing-comment-accesstoken", "err-missing-oembed-accesstok
[params.social]
GitHub = "xxxx"
Linkedin = ""
Twitter = "xxxx"
X = "xxxx"
Instagram = "xxxx"
Facebook = "xxxx"
Telegram = "xxxx"
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
<div id="fixed-buttons">
{{- /* top button */ -}}
<a href="#" id="back-to-top" class="fixed-button" title="{{ T `backToTop` }}">
<i class="fas fa-chevron-up fa-fw"></i>
<i class="fa-solid fa-chevron-up fa-fw"></i>
</a>

{{- /* comment button */ -}}
{{- if .Site.Params.page.comment.enable -}}
<a href="#" id="view-comments" class="fixed-button" title="{{ T `viewComments` }}">
<i class="fas fa-comment-alt fa-fw"></i>
<i class="fa-solid fa-comment-alt fa-fw"></i>
</a>
{{- end -}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h2 class="single-subtitle animated fadeInDown faster">{{ . }}</h2>
<div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "contents" }}</span>
<span><i class="details-icon fas fa-angle-right"></i></span>
<span><i class="details-icon fa-solid fa-angle-right"></i></span>
</div>
<div class="details-content toc-content" id="toc-content-static">
{{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h2 class="single-title" itemprop="name headline">
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fa-solid fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/link.html" $options -}}
</span>

Expand All @@ -42,7 +42,7 @@ <h2 class="single-title" itemprop="name headline">
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- $categories = $categories | append (printf `<a href="%v"><i class="fa-regular fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&nbsp;" -}}
&nbsp;<span class="post-category">
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
{{- if ne .Site.Params.footer.hugo false -}}
<div class="footer-line">
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %v">Hugo</a>` hugo.Version -}}
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/khusika/FeelIt" target="_blank" rel="noopener noreffer" title="FeelIt %v"><i class="fas fa-hand-holding-heart fa-fw"></i> FeelIt</a>` -}}
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/khusika/FeelIt" target="_blank" rel="noopener noreffer" title="FeelIt %v"><i class="fa-solid fa-hand-holding-heart fa-fw"></i> FeelIt</a>` -}}
{{- dict "Hugo" $hugo "Theme" $theme | T "poweredBySome" | safeHTML }}
</div>
{{- end -}}

<div class="footer-line" itemscope itemtype="http://schema.org/CreativeWork">
{{- /* Copyright year */ -}}
{{- if ne .Site.Params.footer.copyright false -}}
<i class="far fa-copyright fa-fw"></i>
<i class="fa-regular fa-copyright fa-fw"></i>
{{- with .Site.Params.footer.since -}}
<span itemprop="copyrightYear">
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/function/checkbox.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- /* Checkbox unchecked */ -}}
{{- $old := `<input disabled="" type="checkbox">` -}}
{{- $new := `<i class="far fa-square fa-fw"></i>` -}}
{{- $new := `<i class="fa-regular fa-square fa-fw"></i>` -}}
{{- $content := replace . $old $new -}}

{{- /* Checkbox checked */ -}}
{{- $old = `<input checked="" disabled="" type="checkbox">` -}}
{{- $new = `<i class="far fa-check-square fa-fw"></i>` -}}
{{- $new = `<i class="fa-regular fa-check-square fa-fw"></i>` -}}
{{- return replace $content $old $new -}}
2 changes: 1 addition & 1 deletion layouts/partials/function/fontawesome.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- /* Font Awesome */ -}}
{{- /* :(far fa-circle): -> <i class="far fa-circle fa-fw"></i> */ -}}
{{- /* :(fa-regular fa-circle): -> <i class="fa-regular fa-circle fa-fw"></i> */ -}}

{{- $REin := ` (:\([\w- ]+?\):)` -}}
{{- $REout := `&nbsp;$1` -}}
Expand Down
24 changes: 12 additions & 12 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{{- if .Site.IsMultiLingual -}}
<span class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw"></i>
<i class="fa-solid fa-chevron-right fa-fw"></i>
<select class="language-select" id="language-select-desktop" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
Expand All @@ -66,21 +66,21 @@
<span class="menu-item search" id="search-desktop">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-desktop">
<a href="#" class="search-button search-toggle" id="search-toggle-desktop" title="{{ T `search` }}">
<i class="fas fa-search fa-fw"></i>
<i class="fa-solid fa-search fa-fw"></i>
</a>
<a href="#" class="search-button search-clear" id="search-clear-desktop" title="{{ T `clear` }}">
<i class="fas fa-times-circle fa-fw"></i>
<i class="fa-solid fa-times-circle fa-fw"></i>
</a>
<span class="search-button search-loading" id="search-loading-desktop">
<i class="fas fa-spinner fa-fw fa-spin"></i>
<i class="fa-solid fa-spinner fa-fw fa-spin"></i>
</span>
</span>
{{- end -}}
{{- with .Site.Params.header.title.rss -}}
<a class="menu-item" href="/index.xml" title="RSS"><i class="fas fa-rss fa-fw" title="RSS"></i> </a>
<a class="menu-item" href="/index.xml" title="RSS"><i class="fa-solid fa-rss fa-fw" title="RSS"></i> </a>
{{- end -}}
<a href="#" onclick="return false;" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw"></i>
<i class="fa-solid fa-adjust fa-fw"></i>
</a>
</div>
</div>
Expand Down Expand Up @@ -125,13 +125,13 @@
<div class="search mobile" id="search-mobile">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-mobile">
<a href="#" class="search-button search-toggle" id="search-toggle-mobile" title="{{ T `search` }}">
<i class="fas fa-search fa-fw"></i>
<i class="fa-solid fa-search fa-fw"></i>
</a>
<a href="#" class="search-button search-clear" id="search-clear-mobile" title="{{ T `clear` }}">
<i class="fas fa-times-circle fa-fw"></i>
<i class="fa-solid fa-times-circle fa-fw"></i>
</a>
<span class="search-button search-loading" id="search-loading-mobile">
<i class="fas fa-spinner fa-fw fa-spin"></i>
<i class="fa-solid fa-spinner fa-fw fa-spin"></i>
</span>
</div>
<a href="#" class="search-cancel" id="search-cancel-mobile">
Expand All @@ -151,17 +151,17 @@
{{- end -}}
<div class="menu-item">
{{- with .Site.Params.header.title.rss -}}
<a href="/index.xml" title="RSS"><i class="fas fa-rss fa-fw" title="RSS"></i> </a>
<a href="/index.xml" title="RSS"><i class="fa-solid fa-rss fa-fw" title="RSS"></i> </a>
<span>&nbsp;|&nbsp;</span>
{{- end -}}
<a href="#" onclick="return false;" class="theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw"></i>
<i class="fa-solid fa-adjust fa-fw"></i>
</a>
</div>
{{- if .Site.IsMultiLingual -}}
<span class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw"></i>
<i class="fa-solid fa-chevron-right fa-fw"></i>
<select class="language-select" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
Expand Down
Loading

0 comments on commit d271e09

Please sign in to comment.