Skip to content

Commit 4342137

Browse files
committed
feat: add mobile pagination to post search view
1 parent cc04331 commit 4342137

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/views/PostSearch.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,19 @@
5454
</div>
5555
</div>
5656
</div>
57-
<div class="sidebar">
58-
<div class="sidebar-block" v-if="searchData?.posts.length > 0">
59-
<div class="pagination-simple">
57+
<div class="actions-bottom" v-if="searchData?.posts.length > 0">
58+
<div class="pagination-slide">
59+
<div class="pagination-controls">
6060
<button @click="pageResults(-1)" :disabled="!searchData?.prev">&#10094; Prev</button>
61+
<div class="page">{{currentPage}}</div>
6162
<button @click="pageResults(1)" :disabled="!searchData?.next">Next &#10095;</button>
6263
</div>
6364
</div>
6465
</div>
6566
</template>
6667

6768
<script>
68-
import { reactive, toRefs, nextTick, watch } from 'vue'
69+
import { reactive, toRefs, nextTick, watch, computed } from 'vue'
6970
import { postsApi } from '@/api'
7071
import { useRoute, useRouter } from 'vue-router'
7172
import humanDate from '@/composables/filters/humanDate'
@@ -128,7 +129,7 @@ export default {
128129
const $router = useRouter()
129130
130131
const v = reactive({
131-
currentPage: Number($route.query.page) || 1,
132+
currentPage: computed(() => Number($route.query.page) || 1),
132133
searchData: null,
133134
search: $route.query.search,
134135
searchInput: null
@@ -149,15 +150,6 @@ export default {
149150
@include break-mobile-sm { grid-template-areas: unset; }
150151
}
151152
.main { grid-area: main; }
152-
.sidebar {
153-
grid-area: sidebar;
154-
.sidebar-block {
155-
display: block;
156-
position: sticky;
157-
top: $header-offset;
158-
padding-top: .5rem;
159-
}
160-
}
161153
.search-results {
162154
@include pad(0 0 1rem 0);
163155
clear: both;

0 commit comments

Comments
 (0)