summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/design_management/components/toolbar/pagination_button.vue
blob: f00ecefca01dc7239ff30a43e7a8a1752ad06679 (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
48
<script>
import Icon from '~/vue_shared/components/icon.vue';
import { DESIGN_ROUTE_NAME } from '../../router/constants';

export default {
  components: {
    Icon,
  },
  props: {
    design: {
      type: Object,
      required: false,
      default: null,
    },
    title: {
      type: String,
      required: true,
    },
    iconName: {
      type: String,
      required: true,
    },
  },
  computed: {
    designLink() {
      if (!this.design) return {};

      return {
        name: DESIGN_ROUTE_NAME,
        params: { id: this.design.filename },
        query: this.$route.query,
      };
    },
  },
};
</script>

<template>
  <router-link
    :to="designLink"
    :disabled="!design"
    :class="{ disabled: !design }"
    :aria-label="title"
    class="btn btn-default"
  >
    <icon :name="iconName" />
  </router-link>
</template>