2021-07-28 09:15:52 -04:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import './RawIcon.scss';
|
|
|
|
|
2023-01-14 23:22:58 -05:00
|
|
|
function RawIcon({ color, size, src, isImage }) {
|
2021-12-30 02:14:14 -05:00
|
|
|
const style = {};
|
2021-07-28 09:15:52 -04:00
|
|
|
if (color !== null) style.backgroundColor = color;
|
2021-12-30 02:14:14 -05:00
|
|
|
if (isImage) {
|
|
|
|
style.backgroundColor = 'transparent';
|
2023-01-14 23:22:58 -05:00
|
|
|
style.backgroundImage = `url("${src}")`;
|
2021-12-30 02:14:14 -05:00
|
|
|
} else {
|
2023-01-14 23:22:58 -05:00
|
|
|
style.WebkitMaskImage = `url("${src}")`;
|
|
|
|
style.maskImage = `url("${src}")`;
|
2021-12-30 02:14:14 -05:00
|
|
|
}
|
|
|
|
|
2023-01-14 23:22:58 -05:00
|
|
|
return <span className={`ic-raw ic-raw-${size}`} style={style} />;
|
2021-07-28 09:15:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
RawIcon.defaultProps = {
|
|
|
|
color: null,
|
|
|
|
size: 'normal',
|
2021-12-30 02:14:14 -05:00
|
|
|
isImage: false,
|
2021-07-28 09:15:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
RawIcon.propTypes = {
|
|
|
|
color: PropTypes.string,
|
|
|
|
size: PropTypes.oneOf(['large', 'normal', 'small', 'extra-small']),
|
|
|
|
src: PropTypes.string.isRequired,
|
2021-12-30 02:14:14 -05:00
|
|
|
isImage: PropTypes.bool,
|
2021-07-28 09:15:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export default RawIcon;
|