Merge pull request #7 from koirand/layout-change

Layout change
Close #6
This commit is contained in:
Kazuki Koide 2019-03-23 16:18:39 +09:00 committed by GitHub
commit 58448ada6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 210 additions and 182 deletions

View file

@ -2,11 +2,6 @@
<html>
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
<div class="main">
{{ block "main" . }}{{ end }}
</div>
{{ partial "footer.html" . }}
</body>
</html>

View file

@ -1,10 +1,14 @@
{{ define "main"}}
<div>
<div class="searchBoxContainer">
<input type="text" id="searchBox" class="searchBox" placeholder="Search..." />
<img id="searchBoxIcon" class="searchBoxIcon" src="/img/search.png" />
{{ partial "header.html" . }}
<!-- search box -->
<div id="searchBox">
<input type="text" id="searchBoxInput" placeholder="Search..." />
<img id="searchBoxIcon" src="/img/search.png" />
</div>
<div id="searchResults" class="searchResults"></div>
<!-- search results -->
<div id="searchResults"></div>
<!-- contents -->
<div id="contentsList">
{{ range $index, $value := .Pages.GroupByDate .Site.Params.listPageDateFormat }}
{{ if (ne $index 0) }}
<hr class="separator">
@ -15,6 +19,7 @@
{{ end }}
{{ end }}
</div>
{{ partial "footer.html" . }}
<script src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/jquery.mark.es6.min.js"></script>
<script src="/js/fuse.min.js"></script>

View file

@ -1,10 +1,11 @@
{{ define "main"}}
<div>
<h1>{{ .Title }}</h1>
{{ partial "header.html" . }}
<!-- date -->
<p class="date">{{ .Date.Format .Site.Params.singlePageDateFormat }}</p>
<!-- content -->
<div class="markdown-body">
{{ .Content }}
</div>
</div>
{{ partial "footer.html" . }}
{{ end }}

View file

@ -2,16 +2,22 @@
<html>
{{- partial "head.html" . -}}
<body>
<div class="profile">
<div class="profile-body">
<div id="profileContainer">
<div id="profile">
<header>
<!-- avator -->
<div class="avatar">
<img class="avatar-mask" src="/img/{{ .Site.Params.avatar }}">
<img src="/img/avatar-border.svg">
<img class="avatarMask" src="/img/{{ .Site.Params.avatar }}" alt="avatar">
<img src="/img/avatar-border.svg" alt="avatar-border">
</div>
<!-- author -->
<h1 class="author">{{ .Site.Params.Author }}</h1>
</header>
<!-- discription -->
<p>
{{ .Site.Params.discription }}
</p>
<!-- navigation -->
<nav>
<ul>
{{ range .Site.Menus.main }}

View file

@ -1,6 +1,9 @@
<header>
<!-- avator -->
<div class="avatar">
<img class="avatar-mask" src="/img/{{ .Site.Params.avatar }}">
<img class="avatarMask" src="/img/{{ .Site.Params.avatar }}">
<a href="/"><img src="/img/avatar-border.svg"></a>
</div>
<!-- author -->
<h2><a class="author" href="/">{{ .Site.Params.Author }}</a></h2>
</header>

View file

@ -1,5 +1,9 @@
/* General */
body {
min-height:100vh;
margin: 0;
padding: 20px;
box-sizing:border-box;
background-color: #EFEFEF;
color: #707070;
text-align: center;
@ -7,20 +11,6 @@ body {
line-height: 1.5;
}
header {
padding: 30px 0;
}
footer {
font-size: 12px;
}
hr.separator {
width: 10px;
margin: 30px auto;
border: solid 1px #C9C9C9;
}
a:link {
color: #707070;
}
@ -37,19 +27,6 @@ a:active {
color: #707070;
}
div.profile {
min-height: calc(100vh - 42px);
display: flex;
justify-content: center;
align-items: center;
}
div.profile-body {
width: 60vw;
max-width: 400px;
min-width: 300px;
}
.author {
color: #C39F59;
}
@ -58,12 +35,13 @@ div.profile-body {
color: #869D38;
}
div.avatar {
/* Header */
header .avatar {
position: relative;
height: 100px;
}
div.avatar img {
header .avatar img {
position: absolute;
width: 100px;
margin: 0 auto;
@ -71,25 +49,44 @@ div.avatar img {
right: 0;
}
div.avatar img.avatar-mask {
header .avatarMask {
clip-path: circle(48px at center);
-webkit-clip-path: circle(48px at center);
}
div.main {
display: flex;
justify-content: center;
min-height: calc(100vh - 202px);
min-width: 300px;
margin: 0 10px;
header a.author:link {
color: #C39F59;
}
div.markdown-body {
width: 90vw;
max-width: 800px;
header a.author:visited {
color: #C39F59;
}
header a.author:hover {
color: #C39F59;
}
header a.author:active {
color: #C39F59;
}
/* Footer */
footer {
font-size: 12px;
box-sizing:border-box;
}
/* Top page */
#profileContainer {
min-height: calc(100vh - 100px);
display: flex;
justify-content: center;
align-items: center;
}
#profile {
max-width: 600px;
min-width: 300px;
margin: 40px auto;
text-align: left;
}
nav ul {
@ -101,14 +98,15 @@ nav ul {
list-style: none;
}
div.searchBoxContainer {
/* Contents List */
#searchBox {
position: relative;
width: 300px;
height: 30px;
margin: 10px auto 50px auto;
margin: 20px auto;
}
input.searchBox {
#searchBox #searchBoxInput {
position: absolute;
width: 100%;
padding: 0 35px 0 15px;
@ -125,17 +123,25 @@ input.searchBox {
box-sizing: border-box;
}
input.searchBox::placeholder {
#searchBox #searchBoxInput::placeholder {
color: #c9c9c9;
}
div.searchResults {
#searchBox #searchBoxIcon {
position: absolute;
height: 20px;
width: 20px;
top: 5px;
right: 10px;
}
#searchResults {
display: none;
position: absolute;
max-width: 600px;
min-width: 300px;
margin: 0 auto;
top: 210px;
top: 240px;
left: 0;
right: 0;
padding: 5px;
@ -146,27 +152,39 @@ div.searchResults {
box-sizing: border-box;
}
div.searchResultPage {
#searchResults .searchResultPage {
padding: 20px
}
div.searchResultTitle {
#searchResults .searchResultTitle {
font-weight: bold;
margin: 5px 0;
}
div.searchResultBody {
#searchResults .searchResultBody {
font-size: 14px;
}
img.searchBoxIcon {
position: absolute;
height: 20px;
width: 20px;
top: 5px;
right: 10px;
}
mark {
#searchResults mark {
background-color: #dddfdf;
}
#contentsList {
padding: 20px;
}
#contentsList hr.separator {
width: 10px;
margin: 30px auto;
border: solid 1px #C9C9C9;
}
/* Page */
div.markdown-body {
width: 90vw;
max-width: 800px;
min-width: 300px;
margin: 0 auto;
padding: 20px;
text-align: left;
}

View file

@ -26,12 +26,12 @@ function initSearch () {
function initUI () {
// Clear query when clear icon is clicked
$('#searchBoxIcon').click(function () {
$('#searchBox').val('')
$('#searchBox').trigger('keyup')
$('#searchBoxInput').val('')
$('#searchBoxInput').trigger('keyup')
})
// Event when chenging query
$('#searchBox').keyup(function () {
$('#searchBoxInput').keyup(function () {
var $searchResults = $('#searchResults')
var query = $(this).val().trim()
@ -56,7 +56,7 @@ function initUI () {
})
// Emit keyup event for when the query is already setted with browser back etc.
$('#searchBox').trigger('keyup')
$('#searchBoxInput').trigger('keyup')
}
/**
@ -65,7 +65,7 @@ function initUI () {
*/
function renderResults (results) {
var $searchResults = $('#searchResults')
var query = $('#searchBox').val()
var query = $('#searchBoxInput').val()
var SUMMARY_INCLUDE = 50
var MAX_PAGES = 10