summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/pagination/graphql_pagination.vue
blob: 53e473432db6b3fc6de9b31bebd5f4b0f71f289e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<script>
import { GlButton } from '@gitlab/ui';
import { PREV, NEXT } from '~/vue_shared/components/pagination/constants';

/**
 * Pagination Component for graphql API
 */
export default {
  name: 'GraphqlPaginationComponent',
  components: {
    GlButton,
  },
  labels: {
    prev: PREV,
    next: NEXT,
  },
  props: {
    hasNextPage: {
      required: true,
      type: Boolean,
    },
    hasPreviousPage: {
      required: true,
      type: Boolean,
    },
  },
};
</script>
<template>
  <div class="justify-content-center d-flex prepend-top-default">
    <div class="btn-group">
      <gl-button
        class="js-prev-btn page-link"
        :disabled="!hasPreviousPage"
        @click="$emit('previousClicked')"
        >{{ $options.labels.prev }}</gl-button
      >

      <gl-button
        class="js-next-btn page-link"
        :disabled="!hasNextPage"
        @click="$emit('nextClicked')"
        >{{ $options.labels.next }}</gl-button
      >
    </div>
  </div>
</template>