UNPKG

@gitlab/ui

Version:
81 lines (68 loc) 2.3 kB
import illustrationsPath from '@gitlab/svgs/dist/illustrations.svg'; import illustrationsInfo from '@gitlab/svgs/dist/illustrations.json'; import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js'; // const knownIllustrations = illustrationsInfo.icons; /** This is a re-usable vue component for rendering a svg sprite icon * @example * <illustration * name="status-success-sm" * /> */ var script = { name: 'GlIllustration', props: { /** * One of the illustrations from https://gitlab-org.gitlab.io/gitlab-svgs/ project */ name: { type: String, required: true, validator: value => { if (knownIllustrations.some(obj => obj.name === value)) { return true; } // eslint-disable-next-line no-console console.warn(`Illustration '${value}' is not a known illustration of @gitlab/svgs`); return false; } } }, computed: { spriteHref() { return `${illustrationsPath}#${this.name}`; }, illustrationSize() { return knownIllustrations.find(obj => obj.name === this.name).svg_size; } } }; /* script */ const __vue_script__ = script; /* template */ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('svg',_vm._g({key:_vm.spriteHref,attrs:{"data-testid":(_vm.name + "-illustration"),"role":"presentation","width":_vm.illustrationSize,"height":_vm.illustrationSize}},_vm.$listeners),[_c('use',{attrs:{"href":_vm.spriteHref}})])}; var __vue_staticRenderFns__ = []; /* style */ const __vue_inject_styles__ = undefined; /* scoped */ const __vue_scope_id__ = undefined; /* module identifier */ const __vue_module_identifier__ = undefined; /* functional template */ const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ /* style inject shadow dom */ const __vue_component__ = /*#__PURE__*/__vue_normalize__( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined ); export { __vue_component__ as default };