sc-react-ions
Version:
An open source set of React components that implement Ambassador's Design and UX patterns.
77 lines (63 loc) • 1.61 kB
JavaScript
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _sprite = require('../../assets/icons/symbol/sprite.svg');
var _sprite2 = _interopRequireDefault(_sprite);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Icon = function Icon(props) {
var name = props.name,
width = props.width,
height = props.height,
fill = props.fill,
className = props.className,
onClick = props.onClick;
return _react2.default.createElement(
'svg',
{
role: 'img',
name: name,
width: width,
height: height,
fill: fill,
className: className,
onClick: onClick,
viewBox: '0 0 24 24' },
_react2.default.createElement('use', { xlinkHref: _sprite2.default + '#' + props.name })
);
};
Icon.defaultProps = {
height: '24',
width: '24'
};
Icon.propTypes = {
/**
* The name of the icon.
*/
name: _propTypes2.default.string.isRequired,
/**
* The width of the icon.
*/
width: _propTypes2.default.string,
/**
* The height of the icon.
*/
height: _propTypes2.default.string,
/**
* The color (fill) of the icon.
*/
fill: _propTypes2.default.string,
/**
* The CSS class of the icon.
*/
className: _propTypes2.default.string,
/**
* A function to be called on click
*/
onClick: _propTypes2.default.func
};
exports.default = Icon;