1
0
Fork 0

Paginated blog

This commit is contained in:
Ava Wroten 2020-03-09 22:30:49 -05:00
parent 2fc4459fd2
commit b11fff8633
3 changed files with 27 additions and 4 deletions

View file

@ -0,0 +1,13 @@
.pagination {
text-align: center;
margin: 1rem;
a {
padding: 1rem;
&.active {
color: white;
text-decoration: none;
}
}
}

View file

@ -4,4 +4,5 @@
@import 'base';
@import 'code';
@import 'content-box';
@import 'pagination';
@import 'utils';

View file

@ -8,12 +8,19 @@
<PostCard v-for="edge in $page.posts.edges" :key="edge.node.id" :post="edge.node"/>
</div>
<div class="pagination">
<Pager :info="$page.posts.pageInfo"/>
</div>
</Layout>
</template>
<page-query>
{
posts: allPost {
query ($page: Int) {
posts: allPost(perPage: 10, page: $page) @paginate {
pageInfo {
totalPages
currentPage
}
edges {
node {
id
@ -42,11 +49,13 @@
<script>
import Author from '~/components/Author.vue'
import PostCard from '~/components/PostCard.vue'
import { Pager } from 'gridsome'
export default {
components: {
Author,
PostCard
PostCard,
Pager
},
metaInfo: {
title: 'Home'