refactor(terms): remove tags and categories class

This commit is contained in:
olOwOlo 2018-11-06 16:07:46 +08:00
parent 8d390991f8
commit 7f314ceecd
No known key found for this signature in database
GPG key ID: 456394B6E7A15EA6
6 changed files with 30 additions and 88 deletions

View file

@ -5,37 +5,37 @@
{{ $terms := .Data.Terms.ByCount -}} {{ $terms := .Data.Terms.ByCount -}}
{{ $length := len $terms -}} {{ $length := len $terms -}}
{{ if eq $name "categories" -}} {{ if eq $name "categories" -}}
<div class="categories"> <div class="terms">
<div class="categories-title"> <div class="terms-title">
{{ if eq $length 0 -}} {{ if eq $length 0 -}}
{{ T "zeroCategoryCounter" }} {{ T "zeroCategoryCounter" }}
{{- else -}} {{- else -}}
{{ T "categoryCounter" $length }} {{ T "categoryCounter" $length }}
{{- end }} {{- end }}
</div> </div>
<div class="categories-tags"> <div class="terms-tags">
{{ range $key, $value := $terms -}} {{ range $key, $value := $terms -}}
<a class="category-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/"> <a class="terms-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/">
{{ $value.Term }} {{ $value.Term }}
<span class="category-count">{{ len $value.Pages }}</span> <span class="terms-count">{{ len $value.Pages }}</span>
</a> </a>
{{ end -}} {{ end -}}
</div> </div>
</div> </div>
{{- else if eq $name "tags" -}} {{- else if eq $name "tags" -}}
<div class="tag-cloud"> <div class="terms">
<div class="tag-cloud-title"> <div class="terms-title">
{{ if eq $length 0 -}} {{ if eq $length 0 -}}
{{ T "zeroTagCounter" }} {{ T "zeroTagCounter" }}
{{- else -}} {{- else -}}
{{ T "tagCounter" $length }} {{ T "tagCounter" $length }}
{{- end }} {{- end }}
</div> </div>
<div class="tag-cloud-tags"> <div class="terms-tags">
{{- range $key, $value := $terms }} {{- range $key, $value := $terms }}
<a href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/"> <a class="terms-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/">
{{ $value.Term }} {{ $value.Term }}
<span class="tag-count">{{ len $value.Pages }}</span> <span class="terms-count">{{ len $value.Pages }}</span>
</a> </a>
{{ end -}} {{ end -}}
</div> </div>

View file

@ -1,43 +0,0 @@
.categories {
margin: 2em 0 3em;
text-align: center;
font-family: $global-serif-font-family;
.categories-title {
display: inline-block;
font-size: $categories-title-size;
color: $theme-color;
border-bottom: $categories-title-border-bottom;
}
.categories-tags {
margin: 10px 0;
.category-link {
display: inline-block;
position: relative;
margin: $categories-tags-link-margin;
word-wrap: break-word;
transition-duration: 0.2s;
transition-property: transform;
transition-timing-function: ease-out;
.category-count {
display: inline-block;
position: relative;
top: -8px;
right: -2px;
color: $theme-color;
font-size: $category-count-font-size;
}
&:active,
&:focus,
&:hover {
color: $theme-color;
transform: scale(1.1);
}
}
}
}

View file

@ -1,5 +1,3 @@
@import "../../iconfont";
.admonition { .admonition {
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),
0 1px 5px 0 rgba(0,0,0,.12), 0 1px 5px 0 rgba(0,0,0,.12),

View file

@ -1,38 +1,38 @@
// ============================== // ==============================
// Tags // General Terms(tags, categories, etc.)
// ============================= // =============================
.tag-cloud { .terms {
margin: 2em 0 3em; margin: 2em 0 3em;
text-align: center; text-align: center;
font-family: $global-serif-font-family; font-family: $global-serif-font-family;
.tag-cloud-title { .terms-title {
display: inline-block; display: inline-block;
font-size: $tag-cloud-title-size; font-size: $terms-title-size;
color: $theme-color; color: $theme-color;
border-bottom: $tag-cloud-title-border-bottom; border-bottom: $terms-title-border-bottom;
} }
.tag-cloud-tags { .terms-tags {
margin: 10px 0; margin: 10px 0;
a { .terms-link {
display: inline-block; display: inline-block;
position: relative; position: relative;
margin: $tag-cloud-tags-link-margin; margin: $terms-link-margin;
word-wrap: break-word; word-wrap: break-word;
transition-duration: 0.2s; transition-duration: 0.2s;
transition-property: transform; transition-property: transform;
transition-timing-function: ease-out; transition-timing-function: ease-out;
.tag-count { .terms-count {
display: inline-block; display: inline-block;
position: relative; position: relative;
top: -8px; top: -8px;
right: -2px; right: -2px;
color: $theme-color; color: $theme-color;
font-size: $category-count-font-size; font-size: $terms-count-font-size;
} }
&:active, &:active,

View file

@ -312,27 +312,15 @@ $archive-post-hover-transition: 0.2s ease-out !default;
// Transform of the archive post when hover it. // Transform of the archive post when hover it.
$archive-post-hover-transform: translateX(4px) !default; $archive-post-hover-transform: translateX(4px) !default;
// ========== General Terms ========== //
// Font size of the terms title.
$terms-title-size: 18px !default;
// ========== Tags ========== // // Border bottom of the terms title.
// Font soze of the tag cloud title. $terms-title-border-bottom: 2px solid $theme-color !default;
$tag-cloud-title-size: 18px !default;
// Border bottom of the tag cloud title. // Margin of the terms link.
$tag-cloud-title-border-bottom: 2px solid $theme-color !default; $terms-link-margin: 5px 10px !default;
// Margin of the tag cloud tags link. // Font size of the terms count
$tag-cloud-tags-link-margin: 5px 10px !default; $terms-count-font-size: 12px !default;
// ========== Categories ========== //
// Font soze of the categories title.
$categories-title-size: 18px !default;
// Border bottom of the categories title.
$categories-title-border-bottom: 2px solid $theme-color !default;
// Margin of the categories tags link.
$categories-tags-link-margin: 5px 10px !default;
// Font size of the category count
$category-count-font-size: 12px !default;

View file

@ -11,8 +11,7 @@
@import "_partial/pagination"; @import "_partial/pagination";
@import "_partial/footer"; @import "_partial/footer";
@import "_partial/archive"; @import "_partial/archive";
@import "_partial/tags"; @import "_partial/terms";
@import "_partial/categories";
@import "_partial/slideout"; @import "_partial/slideout";
@import "_partial/mobile"; @import "_partial/mobile";
@import "_partial/back-to-top"; @import "_partial/back-to-top";