bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/common/icon/component.jsx

35 lines
817 B
React
Raw Normal View History

import React, { memo } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
2023-02-21 21:29:51 +08:00
import { omit } from 'radash';
2022-07-04 23:27:46 +08:00
import Styled from './styles';
const propTypes = {
iconName: PropTypes.string.isRequired,
prependIconName: PropTypes.string,
2022-07-04 23:27:46 +08:00
rotate: PropTypes.bool,
2023-09-11 21:12:37 +08:00
className: PropTypes.string,
color: PropTypes.string,
};
const Icon = ({
2024-06-11 21:05:08 +08:00
className = '',
prependIconName = 'icon-bbb-',
iconName,
2024-06-11 21:05:08 +08:00
rotate = false,
color = undefined,
...props
}) => (
2022-07-04 23:27:46 +08:00
<Styled.Icon
color={color}
2017-10-11 06:08:51 +08:00
className={cx(className, [prependIconName, iconName].join(''))}
// ToastContainer from react-toastify passes a useless closeToast prop here
2023-02-21 21:29:51 +08:00
{...omit(props, ['closeToast', 'animations', 'loading'])}
2022-07-04 23:27:46 +08:00
$rotate={rotate}
2017-10-11 06:08:51 +08:00
/>
);
2017-10-23 20:25:05 +08:00
export default memo(Icon);
Icon.propTypes = propTypes;