Files
cinny/src/app/atoms/system-icons/RawIcon.jsx
T

33 lines
779 B
React
Raw Normal View History

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