UNPKG

@uiw/react-shields

Version:

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

27 lines 951 B
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; var _excluded = ["type", "platform", "base", "user", "repo"]; import React from 'react'; import { Internal } from '../common/Base'; import { jsx as _jsx } from "react/jsx-runtime"; var Social = /*#__PURE__*/React.forwardRef((props, ref) => { var { type = 'followers', platform = 'github', base = 'https://img.shields.io', user, repo } = props, other = _objectWithoutPropertiesLoose(props, _excluded); var getUrl = () => { if (platform !== 'github') return ''; if (type === 'followers') return [base, platform, type, user].join('/'); return [base, platform, type, user, repo].join('/'); }; return /*#__PURE__*/_jsx(Internal, _extends({ imgSrc: getUrl(), ref: ref }, other)); }); Social.displayName = 'Social'; export default Social;