Merge branch 'feature-picture-set-grid-and-change-bootstrap' into dev

This commit is contained in:
FarseaSH 2021-09-02 12:53:39 +08:00
commit 5cc4be3e19
8 changed files with 286 additions and 161 deletions

View file

@ -11,12 +11,12 @@
{{ end }} {{ end }}
<!-- Pagination --> <!-- Pagination -->
<nav aria-label="Page navigation .pagination-lg"> <div class="center">
<ul class="pagination justify-content-center"> <div class="pagination">
{{ block "pagination" . }} {{ block "pagination" . }}
{{ end }} {{ end }}
</ul> </div>
</nav> </div>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}
</div> </div>

View file

@ -1,5 +1,5 @@
{{ define "main" }} {{ define "main" }}
<div class="container bodycontainer"> <div class="container">
{{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
{{ partial "row.html" . }} {{ partial "row.html" . }}
@ -11,31 +11,28 @@
{{ define "pagination" }} {{ define "pagination" }}
{{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }}
{{ if $paginator.HasPrev }} {{ if $paginator.HasPrev }}
<li class="page-item">
<a class="page-link" href="{{$.Site.BaseURL}}/{{sub $paginator.PageNumber 1 }}" tabindex="-1">Previous</a> <a class="page-link" href="{{$.Site.BaseURL}}/{{sub $paginator.PageNumber 1 }}">
</li> <div class="page-item">Previous</div>
</a>
{{ else }} {{ else }}
<li class="page-item disabled"> <div class="page-item disabled">Previous</div>
<a class="page-link" href="{{$.Site.BaseURL}}/{{sub $paginator.PageNumber 1 }}" tabindex="-1">Previous</a>
</li>
{{ end }} {{ end }}
{{ $current_num := $paginator.PageNumber }} {{ $current_num := $paginator.PageNumber }}
{{ range (seq 1 $paginator.TotalPages) }} {{ range (seq 1 $paginator.TotalPages) }}
{{ if (eq $current_num .)}} {{ if (eq $current_num .)}}
<li class="page-item active"><a class="page-link" href="{{$.Site.BaseURL}}/{{.}}">{{.}}</a></li> <div class="page-item active">{{.}}</div>
{{ else }} {{ else }}
<li class="page-item"><a class="page-link" href="{{$.Site.BaseURL}}/{{.}}">{{.}}</a></li> <a class="page-link" href="{{$.Site.BaseURL}}/{{.}}"><div class="page-item">{{.}}</div></a>
{{ end }} {{ end }}
{{end}} {{end}}
{{ if $paginator.HasNext }} {{ if $paginator.HasNext }}
<li class="page-item"> <a class="page-link" href="{{$.Site.BaseURL}}/{{ add $paginator.PageNumber 1 }}">
<a class="page-link" href="{{$.Site.BaseURL}}/{{ add $paginator.PageNumber 1 }}">Next</a> <div class="page-item">Next</div>
</li> </a>
{{ else }} {{ else }}
<li class="page-item disabled"> <div class="page-item disabled">Next</div>
<a class="page-link" href="{{$.Site.BaseURL}}/{{ add $paginator.PageNumber 1 }}">Next</a>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -1,5 +1,3 @@
<footer class="footer mt-auto py-3"> <div class="footer">
<div class="container footcontainer"> Powered by <a href="https://www.hugo.io">Hugo</a> | Theme <a href="https://github.com/FarseaSH/hugo-theme-moments">Moments</a>
<div class="text-muted">Powered by <a href="https://www.hugo.io">Hugo</a> | Theme <a href="https://github.com/FarseaSH/hugo-theme-moments">Moments</a></div>
</div> </div>
</footer>

View file

@ -1,9 +1,11 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> -->
<!-- todo change jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- 点赞 --> <!-- 点赞 -->
<link href="https://cdn.bootcss.com/font-awesome/5.8.2/css/all.min.css" rel="stylesheet"> <link href="https://cdn.bootcss.com/font-awesome/5.8.2/css/all.min.css" rel="stylesheet">
@ -34,5 +36,10 @@
<!-- fancybox css (js in the end before the body closing tag) --> <!-- fancybox css (js in the end before the body closing tag) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css"/> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css"/>
<!-- pure.css -->
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/base-min.css">
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/grids-min.css">
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/grids-responsive-min.css">
<!-- website title --> <!-- website title -->
<title>{{ .Site.Params.title }}</title> <title>{{ .Site.Params.title }}</title>

View file

@ -1,7 +1,7 @@
<div class="jumbotron jumbotron-fluid" style="background-image: url({{ .Site.Params.cover }}); <div class="jumbotron jumbotron-fluid" style="background-image: url({{ .Site.Params.cover }});
background-position: center center;background-size: cover; min-height: 200px; text-align: center"> background-position: center center;background-size: cover; min-height: 200px; text-align: center">
<div class="container"> <div class="container">
<h1 class="display-4 text-secondary">{{ .Site.Params.title }}</h1> <div class="site-title">{{ .Site.Params.title }}</div>
<p class="lead text-black-50">{{ .Site.Params.signature }}</p> <p class="signature">{{ .Site.Params.signature }}</p>
</div> </div>
</div> </div>

View file

@ -1,33 +1,17 @@
<!-- START --> <!-- START -->
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <div class="pic-grid">
<ol class="carousel-indicators"> <!-- todo change display style for 2 * 2 -->
<div class="pure-g">
{{ range $num, $a := .pic_set }} {{ range $num, $a := .pic_set }}
{{if eq $num 0 }} <div class="pure-u-1-3">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <div class="add-padding">
{{ else }} <div class="img-container">
<li data-target="#carouselExampleIndicators" data-slide-to="{{$num}}"></li> <a data-src="{{ $a }}" data-fancybox="gallery">
{{ end }} <img src="{{ $a }}" alt="pictures"/>
{{end}}
</ol>
<div class="carousel-inner">
{{range $num,$a := .pic_set}}
{{if eq $num 0 }}
<div class="carousel-item active">
<img src="{{$a}}" class="d-block w-100 pic-in-set" alt="{{add $num 1}}" data-fancybox="gallery">
</div>
{{else}}
<div class="carousel-item">
<img src="{{$a}}" class="d-block w-100 pic-in-set" alt="{{add $num 1}}" data-fancybox="gallery">
</div>
{{end}}
{{end}}
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a> </a>
</div> </div>
</div>
</div>
{{ end }}
</div>
</div>

View file

@ -1,12 +1,18 @@
<div class="row"> <div class="moment-row">
<div class="pure-g">
<!-- 时间 --> <!-- 时间 -->
<div class="col-sm-4 time"> <div class="pure-u-1 pure-u-sm-1-3">
<h2>{{ .Date.Format "Jan 2"}}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }}</h2> <div class="time">
<h4>{{ .Date.Format "2006"}}</h4> <div class="month-day">{{ .Date.Format "Jan 2"}}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22)
.Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }}</div>
<div class="year">{{ .Date.Format "2006"}}</div>
</div>
</div> </div>
<!-- 正文 --> <!-- 正文 -->
<div class="col-sm-8"> <div class="pure-u-1 pure-u-sm-2-3">
<div class="moment-content">
<!-- 置顶标签 --> <!-- 置顶标签 -->
{{ if gt .Params.top 0}} {{ if gt .Params.top 0}}
<div class="top-mark" style="position: absolute; right: 5%;"> <div class="top-mark" style="position: absolute; right: 5%;">
@ -15,19 +21,20 @@
{{ end }} {{ end }}
<!-- 抬头 --> <!-- 抬头 -->
<!-- 头像前面margin2px --> <div class="user-info">
<div style="margin-top: 2px;"> <div class="avatar-block">
{{ with .Params.avatar }} {{ with .Params.avatar }}
<img src='{{ . }}' class="avatar"> <img src='{{ . }}' class="avatar">
{{ else }} {{ else }}
<!-- fixme check whether the default avatar path is url or not--> <!-- fixme check whether the default avatar path is url or not-->
<img src='{{ $.Site.BaseURL }}/{{ .Site.Params.avatar }}' class="avatar"> <img src='{{ $.Site.BaseURL }}/{{ .Site.Params.avatar }}' class="avatar">
{{ end }} {{ end }}
</div>
<div class="intro"> <div class="intro">
{{ with .Params.name }} {{ with .Params.name }}
<h4 class="text-primary name">{{ . }}</h4> <div class="name">{{ . }}</div>
{{ else }} {{ else }}
<h4 class="text-primary name">{{ .Site.Params.name }}</h4> <div class="name">{{ .Site.Params.name }}</div>
{{ end }} {{ end }}
<div> <div>
{{ $tags_filtered := slice}} {{ $tags_filtered := slice}}
@ -77,18 +84,20 @@
{{ $link_text := .Params.link_text }} {{ $link_text := .Params.link_text }}
{{ with .Params.link }} {{ with .Params.link }}
{{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl" $.Site.BaseURL)}} {{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl"
$.Site.BaseURL)}}
{{ end }} {{ end }}
<!-- 附注信息 --> <!-- 附注信息 -->
<div> <div class="moment-note">
<p class="text-black-50 note"> <p class="note">{{ .Date.Format "15:04" }} {{ .Params.note }}</p>
{{ .Date.Format "15:04" }} {{ .Params.note }} <div style="padding-right: 12px;"><i class="far fa-heart"></i></div>
</p>
<i class="far fa-heart" style="float: right; margin-right: 5px; color:#808080"></i>
</div> </div>
</div> </div>
<!-- 分隔线 --> <!-- 分隔线 -->
<hr style="clear: both"> <hr style="clear: both">
</div> </div>
</div> </div>
</div>
</div>

View file

@ -2,6 +2,82 @@
body{ body{
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.pure-g [class*=pure-u]{
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji" !important;
font-weight: normal;
font-size: 16px;
line-height: 24px;
color: rgb(33, 37, 41);
}
p{
margin-top: 0;
}
/* START - top cover part */
.jumbotron{
padding-top: 64px;
}
.site-title{
color: rgb(108, 117, 125);
font-size: 56px;
font-weight: 300;
margin-bottom: 20px;
}
.signature{
color: rgb(0, 0, 0, 0.5);
font-size: 20px;
font-weight: 300;
}
/* END - top cover part */
/* START - pagination */
.center{
display: flex;
justify-content: center;
}
.pagination{
display: flex;
margin-top: 20px;
margin-bottom: 30px;
}
.pagination a{
color: #337cf6;
text-decoration: none;
}
.page-item{
border: #80808050;
border-style: solid;
border-width: 0.5px;
border-radius: 2%;
padding-left: 10px;
padding-right: 10px;
padding-top: 10px;
padding-bottom: 10px;
}
.page-link .page-item:hover{
background-color: #eaecef;
color: #2157ad;
}
.page-item.active{
background-color: #337cf6;
color: #ffffff;
}
.page-item.disabled{
color:rgb(108, 117, 125)
}
/* END - pagination */
.page{ .page{
max-width: 1150px; max-width: 1150px;
margin: auto; margin: auto;
@ -14,16 +90,21 @@ body{
} }
} }
.bodycontainer{ .container{
max-width: 760px; max-width: 760px;
/* padding-right: 80px; */ margin: auto;
} }
/* 时间 */ .moment-content {
position: relative;
}
/* START - time */
.time{ .time{
text-align: right; text-align: right;
padding-right: 60px; padding-right: 60px;
/* white-space: nowrap; */ /* white-space: nowrap; */
font-weight: 300;
} }
@media (max-width: 576px){ @media (max-width: 576px){
.time{ .time{
@ -36,8 +117,22 @@ body{
padding-right: 20px; padding-right: 20px;
} }
} }
.time .month-day{
font-size: 24px;
margin-bottom: 10px;
}
.time .year{
font-size: 16px;
}
/* END - time */
/* 抬头 */ /* 抬头 */
.user-info{
display: flex;
}
.avatar{ .avatar{
max-height: 45px; max-height: 45px;
float: left; float: left;
@ -53,15 +148,18 @@ body{
color:#186D9C!important; color:#186D9C!important;
margin-bottom: 0; margin-bottom: 0;
line-height: 1.1; line-height: 1.1;
font-size: 24px;
} }
.tag::before{ .tag::before{
content:"#" content:"#";
padding-right: 1px;
} }
.tag{ .tag{
font-size: 80%; font-size: 80%;
margin-left: 0px; margin-left: 0px;
margin-right: 10px; margin-right: 10px;
color: #6c757d!important;
} }
/* 正文 */ /* 正文 */
@ -78,14 +176,27 @@ body{
margin-top: 5px; margin-top: 5px;
} }
/* 图片集 */ /* 图片集 */
#carouselExampleIndicators{ .pic-grid{
width: 80%; max-width: 80%;
padding-bottom:10px;
margin-top: 5px;
} }
.pic-in-set{ .pic-grid .img-container{
height: 250px; padding-top: 50%;
padding-bottom: 50%;
position: relative;
height: 0px;
}
.pic-grid img{
object-fit: cover;
height: 100%;
width: 100%;
position: absolute;
top: 0
}
.pic-grid .add-padding{
padding: 2.5px;
} }
/* 内容附带的超链接 */ /* 内容附带的超链接 */
@ -109,26 +220,45 @@ body{
} }
/* 附注信息 */ /* 附注信息 */
.note{ .moment-note{
display: flex;
margin-bottom: 10px;
justify-content: space-between;
}
.moment-note .note{
font-size: 80%; font-size: 80%;
text-indent: 20px; text-indent: 20px;
float: left; color: rgb(0, 0, 0, 0.5);
margin-bottom: 10px;
margin-top: 0;
margin-bottom: 0;
}
.moment-note{
margin-right: 5px;
color:#808080
}
/* hr */
hr {
border-width: 0;
border-top: 1px solid;
border-color: rgb(0, 0, 0, 0.1);
} }
/* footer底注 */ /* footer底注 */
.footer { .footer {
padding-top: 20px;
padding-bottom: 30px;
background-color: #f5f5f5; background-color: #f5f5f5;
color: #6c757d !important;
text-align: center; text-align: center;
font-size: 95%; font-size: 95%;
} }
.footcontainer {
width: auto;
padding-right: 15px;
padding-left: 15px;
}
.footcontainer a{ .footer a{
text-decoration: underline !important; text-decoration: underline !important;
color:#6c757d !important; color:#6c757d !important;
} }