bigbuffet-rw/app/soapbox/components/svg_icon.js
2021-09-12 18:57:30 -05:00

29 lines
620 B
JavaScript

/**
* SvgIcon: abstact component to render SVG icons.
* @module soapbox/components/svg_icon
* @see soapbox/components/icon
*/
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import InlineSVG from 'react-inlinesvg';
export default class SvgIcon extends React.PureComponent {
static propTypes = {
src: PropTypes.string.isRequired,
className: PropTypes.string,
};
render() {
const { src, className } = this.props;
return (
<div className={classNames('svg-icon', className)}>
<InlineSVG src={src} />
</div>
);
}
}