Welcome to mirror list, hosted at ThFree Co, Russian Federation.

icon_utils.js « utils « lib « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7b8dd9bbef79872e85eb7f33976a47be726b9283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* eslint-disable import/prefer-default-export */

import axios from '~/lib/utils/axios_utils';

/**
 * Retrieve SVG icon path content from gitlab/svg sprite icons
 * @param {String} name
 */
export const getSvgIconPathContent = name =>
  axios
    .get(gon.sprite_icons)
    .then(({ data: svgs }) =>
      new DOMParser()
        .parseFromString(svgs, 'text/xml')
        .querySelector(`#${name} path`)
        .getAttribute('d'),
    )
    .catch(() => null);