summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/pagination_bar/pagination_bar.stories.js
blob: fd9d69bae22d766a3b75df00660c4d5103368301 (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
import PaginationBar from './pagination_bar.vue';

export default {
  component: PaginationBar,
  title: 'vue_shared/pagination_bar/pagination_bar',
};

const Template = (args, { argTypes }) => ({
  components: { PaginationBar },
  props: Object.keys(argTypes),
  template: `<pagination-bar v-bind="$props" v-on="{ 'set-page-size': setPageSize, 'set-page': setPage }" />`,
});

export const Default = Template.bind({});

Default.args = {
  pageInfo: {
    perPage: 20,
    page: 2,
    total: 83,
    totalPages: 5,
  },
  pageSizes: [20, 50, 100],
};

Default.argTypes = {
  pageInfo: {
    description: 'Page info object',
    control: { type: 'object' },
  },
  pageSizes: {
    description: 'Array of possible page sizes',
    control: { type: 'array' },
  },

  // events
  setPageSize: { action: 'set-page-size' },
  setPage: { action: 'set-page' },
};