card, classic summary mode surpport

This commit is contained in:
zzossig 2019-11-12 12:10:27 +09:00
parent e55f459539
commit 25319a08ad
11 changed files with 127 additions and 27 deletions

View File

@ -1,6 +1,7 @@
# Zzo theme for Hugo # Zzo theme for Hugo
Thank you for click me!. Zzo theme is a blog theme for Hugo with free(always), and many features. If you find any bugs, or wanna share your custom color skin, or have some good idea to share with me and others who use this theme, feel free to open [github](https://github.com/zzossig/hugo-theme-zzo/issues) issue or pull request so that I can make this theme better. Thank you for click me!. Zzo theme is a blog theme for Hugo with free(always), and many features. If you find any bugs, or wanna share your custom color skin, or have some good idea to share with me and others who use this theme, feel free to open [github](https://github.com/zzossig/hugo-theme-zzo/issues) issue or pull request so that I can make this theme better.
![zzo theme for Hugo](https://user-images.githubusercontent.com/52706977/68638044-ace72a80-0543-11ea-94d9-329ef0228f4f.gif)
## Table of contents ## Table of contents
@ -229,6 +230,7 @@ enableSearch = true
enableMark = true enableMark = true
enableGoToTop = true enableGoToTop = true
enableWhoami = true enableWhoami = true
summaryShape = "classic" # card, classic
# sidebar # sidebar
enableSidebarTags = true enableSidebarTags = true

View File

@ -1,4 +1,4 @@
.summary { .summary-card {
padding: 0 1rem; padding: 0 1rem;
.title { .title {
a { a {
@ -45,7 +45,7 @@
} }
} }
.video { &__video {
width: 100%; width: 100%;
max-height: 500px; max-height: 500px;
object-fit: contain; object-fit: contain;
@ -70,3 +70,66 @@
} }
} }
} }
.summary-classic {
padding: 0 1rem;
.title {
font-size: 24px;
a {
font-family: $summary_title_font;
font-weight: 700;
@include themify($themes) {
color: themed('title-color');
@include on-event {
color: themed('link-hover');
}
}
}
}
.subtitle {
font-family: $summary_subtitle_font;
@include themify($themes) {
color: themed('meta-color');
}
}
&__flex-box {
@include flexbox();
margin-top: 0.5rem;
margin-bottom: 1rem;
}
&__content {
@include flexbox();
@include flex-direction(column);
@include justify-content(flex-start);
padding-left: 1rem;
}
&__text {
margin-top: 1rem;
line-height: 1.7rem;
font-family: $summary_text_font;
}
&__image {
width: 100%;
height: 100%;
object-fit: contain;
&-wrapper {
max-height: 170px;
max-width: 170px;
min-width: 170px;
@include align-self(center);
}
}
hr {
border-radius: 5rem;
@include themify($themes) {
border-top: 1px solid themed('hr-color');
}
}
}

View File

@ -6,7 +6,7 @@ $dark: (
title-color: #ffd866, title-color: #ffd866,
meta-color: #FCFCFA, meta-color: #FCFCFA,
body-color: #FCFCFA, body-color: #FCFCFA,
hr-color: #fcfcfa, hr-color: #403E41,
body-background-color: #2D2A2E, body-background-color: #2D2A2E,
backdrop-background-color: #212121, backdrop-background-color: #212121,
dropdown-border-color: #212121, dropdown-border-color: #212121,

View File

@ -6,7 +6,7 @@ $light: (
title-color: #607d8b, title-color: #607d8b,
meta-color: #424242, meta-color: #424242,
body-color: #424242, body-color: #424242,
hr-color: #fcfcfa, hr-color: #eeeeee,
body-background-color: #fafafa, body-background-color: #fafafa,
backdrop-background-color: #e0e0e0, backdrop-background-color: #e0e0e0,
dropdown-border-color: #bdbdbd, dropdown-border-color: #bdbdbd,

View File

@ -9,7 +9,7 @@ $solarized: (
title-color: $primary-color, title-color: $primary-color,
meta-color: lighten($primary-color, 5%), meta-color: lighten($primary-color, 5%),
body-color: #424242, body-color: #424242,
hr-color: $secondary-color, hr-color: lighten($secondary-color, 25%),
body-background-color: #FDF7E3, body-background-color: #FDF7E3,
backdrop-background-color: #DDD6C7, backdrop-background-color: #DDD6C7,
dropdown-border-color: $primary-color, dropdown-border-color: $primary-color,

View File

@ -13,6 +13,7 @@ enableSearch = true
enableMark = true enableMark = true
enableGoToTop = true enableGoToTop = true
enableWhoami = true enableWhoami = true
summaryShape = "classic" # card, classic
# sidebar # sidebar
enableSidebarTags = true enableSidebarTags = true

View File

@ -39,6 +39,7 @@ rssLimit = 100
enableMark = true enableMark = true
enableGoToTop = true enableGoToTop = true
enableWhoami = true enableWhoami = true
summaryShape = "card" # card, classic
# sidebar # sidebar
enableSidebarTags = true enableSidebarTags = true

View File

@ -1,11 +1,12 @@
<article class="summary"> {{ if eq (lower .Site.Params.summaryShape) "card" }}
<article class="summary-card">
<header> <header>
<h5 class="title h5"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h5> <h5 class="title h5"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h5>
<h6 class="subtitle caption">🕓 {{ .Date.Format (i18n "summary-dateformat") }} · ☕{{ .ReadingTime }} min read</h6> <h6 class="subtitle caption">🕓 {{ .Date.Format (i18n "summary-dateformat") }} · ☕{{ .ReadingTime }} min read</h6>
</header> </header>
{{ $params := .Params }} {{ $params := .Params }}
<div class="summary__content"> <div class="summary-card__content">
<div class="summary__text p2"> <div class="summary-card__text p2">
{{ with $params.Description }} {{ with $params.Description }}
{{ . }} {{ . }}
{{ else }} {{ else }}
@ -13,15 +14,15 @@
{{ end }} {{ end }}
</div> </div>
{{ if $params.featured_image }} {{ if $params.featured_image }}
<div class="summary__image-wrapper"> <div class="summary-card__image-wrapper">
{{ with (print "images/" $params.featured_image) }} {{ with (print "images/" $params.featured_image) }}
<img data-src="{{ . | relURL }}" alt="{{ print $params.featured_image }}" class="lazyload summary__image"> <img data-src="{{ . | relURL }}" alt="{{ print $params.featured_image }}" class="lazyload summary-card__image">
{{ end }} {{ end }}
</div> </div>
{{ else if $params.featured_video }} {{ else if $params.featured_video }}
{{ with print ("videos/poster/" | relURL) $params.featured_video_poster }} {{ with print ("videos/poster/" | relURL) $params.featured_video_poster }}
<div class="video-wrapper"> <div class="summary-card__video-wrapper">
<video class="video" controls preload='none' poster='{{ . | relURL }}' data-setup='{"fluid": true}'> <video class="summary-card__video" controls preload='none' poster='{{ . | relURL }}' data-setup='{"fluid": true}'>
{{ with print ("videos/" | relURL) $params.featured_video }} {{ with print ("videos/" | relURL) $params.featured_video }}
<source src="{{ . | relURL }}" type='video/mp4'> <source src="{{ . | relURL }}" type='video/mp4'>
{{ end }} {{ end }}
@ -32,3 +33,35 @@
</div> </div>
<hr /> <hr />
</article> </article>
{{ else if eq (lower .Site.Params.summaryShape) "classic" }}
<article class="summary-classic">
<div class="summary-classic__flex-box">
{{ $params := .Params }}
{{ if $params.featured_image }}
<div class="summary-classic__image-wrapper">
{{ with (print "images/" $params.featured_image) }}
<img data-src="{{ . | relURL }}" alt="{{ print $params.featured_image }}" class="lazyload summary-classic__image">
{{ end }}
</div>
{{ end }}
<div class="summary-classic__content">
<header>
<h5 class="title h5"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h5>
<h6 class="subtitle caption">🕓 {{ .Date.Format (i18n "summary-dateformat") }} · ☕{{ .ReadingTime }} min read
</h6>
</header>
<div>
<div class="summary-classic__text p2">
{{ with $params.Description }}
{{ . }}
{{ else }}
{{ .Summary }}
{{ end }}
</div>
</div>
</div>
</div>
<hr />
</article>
{{ else }}
{{ end }}

BIN
static/images/tree.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
static/videos/1.mp4 Normal file

Binary file not shown.

BIN
static/videos/poster/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB