bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/common/icon/component.jsx
prlanzarin 0fead2ebbb fix: omit unused props in talking-indicator, input stream selector and emoji button
The talking-indicator, emoji-button and input-live-stream-selector
components are passing props downstream that weren't omitted or handled
by inherited components (Button, Icon). That causes a handful of error
logs to be spammed in the console of dev environments, which is
annoying.

This commit addresses the issue by:
  - Making the talking, spoke, muted and isViewer props transient
    (styled-components) - which means they won't reach the DOM (as
    expected since they're style-only)
  - Omitting the EmojiButton `rotate` prop in the Icon component itself
    * Made that instead of transient because might be useful to migrate
      the rotate code to the Icon component?
2022-06-29 17:15:46 +00:00

32 lines
682 B
JavaScript

import React, { memo } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import _ from 'lodash';
const propTypes = {
iconName: PropTypes.string.isRequired,
prependIconName: PropTypes.string,
};
const defaultProps = {
prependIconName: 'icon-bbb-',
};
const Icon = ({
className,
prependIconName,
iconName,
...props
}) => (
<i
className={cx(className, [prependIconName, iconName].join(''))}
// ToastContainer from react-toastify passes a useless closeToast prop here
{..._.omit(props, ['closeToast', 'animations', 'rotate'])}
/>
);
export default memo(Icon);
Icon.propTypes = propTypes;
Icon.defaultProps = defaultProps;