UNPKG

1.6 kBJavaScriptView Raw
1import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
3import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
4import classNames from 'classnames';
5import React from 'react';
6import PropTypes from 'prop-types';
7import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
8var propTypes = {
9 /**
10 * An icon name without "glyphicon-" prefix. See e.g. http://getbootstrap.com/components/#glyphicons
11 */
12 glyph: PropTypes.string.isRequired
13};
14
15var Glyphicon =
16/*#__PURE__*/
17function (_React$Component) {
18 _inheritsLoose(Glyphicon, _React$Component);
19
20 function Glyphicon() {
21 return _React$Component.apply(this, arguments) || this;
22 }
23
24 var _proto = Glyphicon.prototype;
25
26 _proto.render = function render() {
27 var _extends2;
28
29 var _this$props = this.props,
30 glyph = _this$props.glyph,
31 className = _this$props.className,
32 props = _objectWithoutPropertiesLoose(_this$props, ["glyph", "className"]);
33
34 var _splitBsProps = splitBsProps(props),
35 bsProps = _splitBsProps[0],
36 elementProps = _splitBsProps[1];
37
38 var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[prefix(bsProps, glyph)] = true, _extends2));
39
40 return React.createElement("span", _extends({}, elementProps, {
41 className: classNames(className, classes)
42 }));
43 };
44
45 return Glyphicon;
46}(React.Component);
47
48Glyphicon.propTypes = propTypes;
49export default bsClass('glyphicon', Glyphicon);
\No newline at end of file