UNPKG

@uiw/react-shields

Version:

Shields.io for react component, Quality metadata badges for open source projects.

36 lines 1.32 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; var _excluded = ["type", "platform", "base", "property", "user", "repo", "label"]; import React from 'react'; import { Internal } from '../common/Base'; import { jsx as _jsx } from "react/jsx-runtime"; export var Issues = /*#__PURE__*/React.forwardRef((props, ref) => { var { type = 'issues', platform = 'github', base = 'https://img.shields.io', property, user, repo, label } = props, other = _objectWithoutPropertiesLoose(props, _excluded); var getUrl = () => { if (platform !== 'github') return ''; if (type === 'issues' || /^issues-(raw|closed|closed-raw|pr|pr-raw|pr-closed|pr-closed-raw)/.test(type)) { if (label && (type === 'issues' || /^issues-(raw|pr|pr-raw)/.test(type || ''))) { return [base, platform, type, user, repo, label].join('/'); } return [base, platform, type, user, repo].join('/'); } if (type === 'issueKind') { return [base, platform, type, 'detail', property, user, repo].join('/'); } return ''; }; return /*#__PURE__*/_jsx(Internal, _extends({ imgSrc: getUrl(), ref: ref }, other)); }); Issues.displayName = 'Issues';