fix(icons): allow SVG icons to receive arbitrary props (#9106)

These arbitrary props will allow to handle
native React element events among other things.

Refs #9094
This commit is contained in:
Vladimír Gorej
2023-08-02 14:39:05 +02:00
committed by GitHub
parent e255f510cf
commit 733e51ad65
14 changed files with 156 additions and 164 deletions

View File

@@ -0,0 +1,27 @@
/**
* @prettier
*/
import React from "react"
import PropTypes from "prop-types"
import omit from "lodash/omit"
class UnlockAuthIcon extends React.Component {
mapStateToProps(state, props) {
const ownProps = omit(props, Object.keys(props.getSystem()))
return { state, ownProps }
}
render() {
const { getComponent, ownProps } = this.props
const UnlockIcon = getComponent("UnlockIcon")
return <UnlockIcon {...ownProps} />
}
}
UnlockAuthIcon.propTypes = {
getComponent: PropTypes.func.isRequired,
ownProps: PropTypes.shape({}).isRequired,
}
export default UnlockAuthIcon