Fix pagination

This commit is contained in:
samaradel
2021-10-11 11:32:41 +02:00
parent 0579106206
commit 70aa0ead94
3 changed files with 70 additions and 29 deletions

View File

@@ -52,13 +52,7 @@
</h2> </h2>
</div> </div>
<div class="pagination flex justify-center mb-8"> <div class="pagination flex justify-center mb-8">
<Pagination <Pager :info="blogs.pageInfo" range="10" linkClass="pager-link" />
:baseUrl="baseurl"
:currentPage="blogs.pageInfo.currentPage"
:totalPages="blogs.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="searchResults.length > 7 && blogs.edges.length > 7"
/>
</div> </div>
</div> </div>
</Layout> </Layout>
@@ -116,7 +110,7 @@ query($page: Int){
</page-query> </page-query>
<script> <script>
import PostListItem from "~/components/custom/Cards/PostListItem.vue"; import PostListItem from "~/components/custom/Cards/PostListItem.vue";
import Pagination from "~/components/custom/Pagination.vue"; import { Pager } from "gridsome";
import NewsFilterHeader from "~/components/custom/NewsFilterHeader.vue"; import NewsFilterHeader from "~/components/custom/NewsFilterHeader.vue";
import SearchBox from "~/components/custom/SearchBox.vue"; import SearchBox from "~/components/custom/SearchBox.vue";
import FilterDropdown from "~/components/custom/FilterDropdown.vue"; import FilterDropdown from "~/components/custom/FilterDropdown.vue";
@@ -202,7 +196,7 @@ export default {
}, },
components: { components: {
PostListItem, PostListItem,
Pagination, Pager,
NewsFilterHeader, NewsFilterHeader,
SearchBox, SearchBox,
FilterDropdown, FilterDropdown,
@@ -328,3 +322,21 @@ export default {
}, },
}; };
</script> </script>
<style>
.pagination {
display: inline-block;
font-size: 1.5rem;
text-align: center;
width: 100%;
color: black;
}
.pagination a {
text-align: center;
padding: 0.6rem 1.2rem;
text-decoration: none;
}
.active {
background-color: #70dfc9;
color: white;
}
</style>

View File

@@ -52,13 +52,7 @@
</div> </div>
</div> </div>
<div class="pagination flex justify-center mb-8"> <div class="pagination flex justify-center mb-8">
<Pagination <Pager :info="$page.entries.pageInfo" range="10" linkClass="pager-link" />
:baseUrl="baseurl"
:currentPage="$page.entries.pageInfo.currentPage"
:totalPages="$page.entries.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="searchResults.length > 7 && news.edges.length > 7"
/>
</div> </div>
</Layout> </Layout>
</template> </template>
@@ -110,7 +104,7 @@ query($page: Int){
<script> <script>
import NewsFilterHeader from "~/components/custom/NewsFilterHeader.vue"; import NewsFilterHeader from "~/components/custom/NewsFilterHeader.vue";
import PostListItem from "~/components/custom/Cards/PostListItem.vue"; import PostListItem from "~/components/custom/Cards/PostListItem.vue";
import Pagination from "~/components/custom/Pagination.vue"; import { Pager } from "gridsome";
import SearchBox from "~/components/custom/SearchBox.vue"; import SearchBox from "~/components/custom/SearchBox.vue";
import FilterDropdown from "~/components/custom/FilterDropdown.vue"; import FilterDropdown from "~/components/custom/FilterDropdown.vue";
export default { export default {
@@ -192,7 +186,7 @@ export default {
}, },
components: { components: {
PostListItem, PostListItem,
Pagination, Pager,
NewsFilterHeader, NewsFilterHeader,
SearchBox, SearchBox,
FilterDropdown, FilterDropdown,
@@ -347,3 +341,21 @@ export default {
}; };
</script> </script>
<style>
.pagination {
display: inline-block;
font-size: 1.5rem;
text-align: center;
width: 100%;
color: black;
}
.pagination a {
text-align: center;
padding: 0.6rem 1.2rem;
text-decoration: none;
}
.active {
background-color: #70dfc9;
color: white;
}
</style>

View File

@@ -19,13 +19,7 @@
</div> </div>
</div> </div>
<div class="pagination flex justify-center mb-8"> <div class="pagination flex justify-center mb-8">
<Pagination <Pager :info="$page.entries.pageInfo" range="10" linkClass="pager-link" />
:baseUrl="baseurl"
:currentPage="$page.entries.pageInfo.currentPage"
:totalPages="$page.entries.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="$page.entries.pageInfo.totalPages > 1 && $page.entries.edges.length > 0"
/>
</div> </div>
</Layout> </Layout>
</template> </template>
@@ -82,12 +76,14 @@ query($page: Int){
import PostListItem from "~/components/custom/Cards/PostListItem.vue"; import PostListItem from "~/components/custom/Cards/PostListItem.vue";
import TagFilterHeader from "~/components/custom/TagFilterHeader.vue"; import TagFilterHeader from "~/components/custom/TagFilterHeader.vue";
import Pagination from "~/components/custom/Pagination.vue"; import Pagination from "~/components/custom/Pagination.vue";
import { Pager } from "gridsome";
export default { export default {
components: { components: {
PostListItem, PostListItem,
TagFilterHeader, TagFilterHeader,
Pagination Pagination,
Pager,
}, },
metaInfo() { metaInfo() {
return { return {
@@ -97,7 +93,8 @@ export default {
{ {
key: "description", key: "description",
name: "description", name: "description",
content: "Meet the wide range of passionate and dedicated individuals involved in the ThreeFold movement.", content:
"Meet the wide range of passionate and dedicated individuals involved in the ThreeFold movement.",
}, },
{ {
key: "og:title", key: "og:title",
@@ -107,7 +104,8 @@ export default {
{ {
key: "og:description", key: "og:description",
property: "og:description", property: "og:description",
content: "Meet the wide range of passionate and dedicated individuals involved in the ThreeFold movement.", content:
"Meet the wide range of passionate and dedicated individuals involved in the ThreeFold movement.",
}, },
{ {
key: "og:image", key: "og:image",
@@ -117,7 +115,8 @@ export default {
{ {
key: "twitter:description", key: "twitter:description",
name: "twitter:description", name: "twitter:description",
content: "Meet the wide range of passionate and dedicated individuals involved in the ThreeFold movement.", content:
"Meet the wide range of passionate and dedicated individuals involved in the ThreeFold movement.",
}, },
{ {
key: "twitter:image", key: "twitter:image",
@@ -153,3 +152,21 @@ export default {
}, },
}; };
</script> </script>
<style>
.pagination {
display: inline-block;
font-size: 1.5rem;
text-align: center;
width: 100%;
color: black;
}
.pagination a {
text-align: center;
padding: 0.6rem 1.2rem;
text-decoration: none;
}
.active {
background-color: #70dfc9;
color: white;
}
</style>