forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlyphicon.js
More file actions
35 lines (28 loc) · 782 Bytes
/
Glyphicon.js
File metadata and controls
35 lines (28 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import classNames from 'classnames';
import React from 'react';
import { bsClass, getClassSet, prefix, splitBsProps }
from './utils/bootstrapUtils';
const propTypes = {
/**
* An icon name. See e.g. http://getbootstrap.com/components/#glyphicons
*/
glyph: React.PropTypes.string.isRequired,
};
class Glyphicon extends React.Component {
render() {
const { glyph, className, ...props } = this.props;
const [bsProps, elementProps] = splitBsProps(props);
const classes = {
...getClassSet(bsProps),
[prefix(bsProps, glyph)]: true,
};
return (
<span
{...elementProps}
className={classNames(className, classes)}
/>
);
}
}
Glyphicon.propTypes = propTypes;
export default bsClass('glyphicon', Glyphicon);