pleroma/app/soapbox/components/svg_icon.js
2022-02-12 00:11:15 +01:00

32 lines
664 B
JavaScript

/**
* SvgIcon: abstact component to render SVG icons.
* @module soapbox/components/svg_icon
* @see soapbox/components/icon
*/
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
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, ...other } = this.props;
return (
<div
className={classNames('svg-icon', className)}
{...other}
>
<InlineSVG src={src} />
</div>
);
}
}