Skip to content

Commit

Permalink
Merge pull request #4338 from greenbone/fix-svg-console-errors
Browse files Browse the repository at this point in the history
cleanup svg console errors
  • Loading branch information
daniele-mng authored Feb 17, 2025
2 parents 4e8778a + b0ad06a commit 75a6e89
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/web/components/icon/SvgIconWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const SvgIconWrapper = ({component: Component, size, ...props}) => (
);

SvgIconWrapper.propTypes = {
component: PropTypes.node.isRequired,
component: PropTypes.elementType.isRequired,
size: PropTypes.oneOfType([
PropTypes.oneOf(['tiny', 'small', 'medium', 'large']),
PropTypes.string,
PropTypes.arrayOf(PropTypes.string),
]),
};

Expand Down
13 changes: 10 additions & 3 deletions src/web/components/icon/svgicon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const SvgIcon = ({

if (isDefined(promise) && isDefined(promise.then)) {
setLoading(true);

promise
.then(() => {
setLoading(false);
Expand Down Expand Up @@ -137,7 +137,11 @@ const SvgIcon = ({
};

SvgIcon.propTypes = {
children: PropTypes.func.isRequired,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
PropTypes.func,
]),
color: PropTypes.string,
active: PropTypes.bool,
disabled: PropTypes.bool,
Expand All @@ -146,7 +150,10 @@ SvgIcon.propTypes = {
to: PropTypes.string,
value: PropTypes.any,
onClick: PropTypes.func,
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large']),
size: PropTypes.oneOfType([
PropTypes.oneOf(['tiny', 'small', 'medium', 'large']),
PropTypes.arrayOf(PropTypes.string),
]),
};

export default SvgIcon;
1 change: 1 addition & 0 deletions src/web/utils/proptypes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ const gsaPropTypes = {
shape: ReactPropTypes.shape,
symbol: ReactPropTypes.symbol,
string: ReactPropTypes.string,
elementType: ReactPropTypes.elementType,

capabilities,
counts,
Expand Down

0 comments on commit 75a6e89

Please sign in to comment.