1
0
mirror of https://github.com/danbee/danbarber.me.hugo.git synced 2025-03-04 08:59:18 +00:00

Add blog pagination and adapt to dark

This commit is contained in:
Daniel Barber 2019-10-15 21:18:52 -04:00
parent b1c82f01d3
commit fb4907db1f
8 changed files with 57 additions and 2 deletions

View File

@ -9,6 +9,10 @@
& > * {
@include container
}
@media (prefers-color-scheme: dark) {
border-bottom: 1px dashed $border-color-dark;
}
}
.post__title {

View File

@ -0,0 +1,19 @@
.posts__pagination {
@include container;
display: flex;
margin-top: 1em;
margin-bottom: 1em;
}
.posts__next-link,
.posts__prev-link {
flex-grow: 1;
}
.posts__next-link {
text-align: left;
}
.posts__prev-link {
text-align: right;
}

View File

@ -1,4 +1,8 @@
.site-header {
padding: 0 $pad-min;
border-bottom: 1px dashed $text-color;
@media (prefers-color-scheme: dark) {
border-bottom: 1px dashed $text-color-dark;
}
}

View File

@ -4,6 +4,16 @@ a {
&:hover,
&:focus {
color: $link-color-hover;
text-decoration: underline;
}
@media (prefers-color-scheme: dark) {
color: $link-color-dark;
&:hover,
&:focus {
color: $link-color-hover-dark;
}
}
}

View File

@ -1,8 +1,14 @@
html {
background-color: $background-color;
color: $text-color;
font-family: $body-font-family;
font-size: calc(0.85vmin + 13px);
font-style: normal;
font-weight: 300;
line-height: 1.4;
@media (prefers-color-scheme: dark) {
background-color: $background-color-dark;
color: $text-color-dark;
}
}

View File

@ -33,6 +33,7 @@
// This is where majority of our work takes place and our UI components
// are often composed of Objects and Components
@import "components/site-header";
@import "components/posts";
@import "components/post";
// 7. Utilities utilities and helper classes with ability to override

View File

@ -18,6 +18,7 @@ $border-color-dark: #666;
$link-color: rgb(24, 99, 161);
$link-color-dark: lighten($link-color, 25%);
$link-color-hover: lighten($link-color, 10%);
$link-color-hover-dark: lighten($link-color-dark, 10%);
$footer-link-color: lighten($text-color, 25%);
$footer-link-color-hover: lighten($link-color, 10%);

View File

@ -1,6 +1,6 @@
{{ define "main" }}
<section class="blog-posts">
{{ range .Pages }}
<section class="posts">
{{ range .Paginator.Pages }}
<article class="post">
<header>
<h3 class="post__title"><a href="{{.Permalink}}">{{.Title}}</a></h3>
@ -18,4 +18,14 @@
</article>
{{ end }}
</section>
<section class="posts__pagination">
{{ if .Paginator.HasNext }}
<a class="posts__next-link" href="{{.Paginator.Next.URL}}">← Older</a>
{{ end }}
{{ if .Paginator.HasPrev }}
<a class="posts__prev-link" href="{{.Paginator.Prev.URL}}">Newer →</a>
{{ end }}
</section>
{{ end }}