diff options
author | Simon Knox <psimyn@gmail.com> | 2017-11-27 22:34:03 +0300 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-11-27 22:40:13 +0300 |
commit | 539ea5ebda567e36470f6cec80f5f52d63b76517 (patch) | |
tree | 298b74539bf80f27205b53b524bb9504a06d6e01 /app/assets/javascripts/vue_shared | |
parent | 815f35be4f84646cd723ae3beb0053bbe52ad136 (diff) |
limit icon component size to valid values
Diffstat (limited to 'app/assets/javascripts/vue_shared')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/icon.vue | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/vue_shared/components/icon.vue b/app/assets/javascripts/vue_shared/components/icon.vue index 8f116233e72..4216660da8c 100644 --- a/app/assets/javascripts/vue_shared/components/icon.vue +++ b/app/assets/javascripts/vue_shared/components/icon.vue @@ -12,6 +12,9 @@ /> */ + // only allow classes in images.scss e.g. s12 + const validSizes = [8, 12, 16, 18, 24, 32, 48, 72]; + export default { props: { name: { @@ -22,7 +25,10 @@ size: { type: Number, required: false, - default: 0, + default: 16, + validator(value) { + return validSizes.includes(value); + }, }, cssClasses: { @@ -42,10 +48,11 @@ }, }; </script> + <template> <svg :class="[iconSizeClass, cssClasses]"> - <use + <use v-bind="{'xlink:href':spriteHref}"/> </svg> </template> |