summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/svg_gradient.vue
blob: 5ce45d492f95967fbb9b6622779374505207d4c2 (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
<script>
export default {
  props: {
    colors: {
      type: Array,
      required: true,
      validator(value) {
        return value.length === 2;
      },
    },
    opacity: {
      type: Array,
      required: true,
      validator(value) {
        return value.length === 2;
      },
    },
    identifierName: {
      type: String,
      required: true,
    },
  },
};
</script>
<template>
  <svg height="0" width="0">
    <defs>
      <linearGradient :id="identifierName">
        <stop :stop-color="colors[0]" :stop-opacity="opacity[0]" offset="0%" />
        <stop :stop-color="colors[1]" :stop-opacity="opacity[1]" offset="100%" />
      </linearGradient>
    </defs>
  </svg>
</template>