Skip to content

Commit

Permalink
Fix opensight Icons (#4160)
Browse files Browse the repository at this point in the history
* fix: lucide svg width and height

* change panel close icon
  • Loading branch information
daniele-mng authored Sep 10, 2024
1 parent 638cf34 commit 2cce73f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"i18next": "^23.12.2",
"i18next-http-backend": "^2.5.2",
"ical.js": "^2.0.0",
"lucide-react": "^0.395.0",
"lucide-react": "^0.439.0",
"memoize-one": "^6.0.0",
"moment": "^2.30.1",
"moment-timezone": "^0.5.45",
Expand Down
16 changes: 16 additions & 0 deletions src/web/components/icon/XIcon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* SPDX-FileCopyrightText: 2024 Greenbone AG
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import withSvgIcon from './withSvgIcon';

import {X as Icon} from 'lucide-react';

import IconWithStrokeWidth from 'web/components/icon/IconWithStrokeWidth';

const XIcon = withSvgIcon()(props => (
<IconWithStrokeWidth IconComponent={Icon} {...props} />
));

export default XIcon;
14 changes: 14 additions & 0 deletions src/web/components/icon/__tests__/XIcon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* SPDX-FileCopyrightText: 2024 Greenbone AG
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import {describe} from '@gsa/testing';

import {testIcon} from 'web/components/icon/testing';

import XIcon from '../XIcon';

describe('XIcon component tests', () => {
testIcon(XIcon);
});
10 changes: 3 additions & 7 deletions src/web/components/icon/svgicon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Styled = styled.span`
@media print {
& {
${props => (isDefined(props.onClick) ? {display: 'none'} : undefined)};
${props => (isDefined(props.onClick) ? 'display: none;' : undefined)};
}
}
Expand All @@ -38,8 +38,8 @@ const Styled = styled.span`
props.$isLoading
? 'url(/img/loading.gif) center center no-repeat'
: undefined};
height: ${props => props.height};
width: ${props => props.width};
height: ${props => props.$height};
width: ${props => props.$width};
}
& svg path {
Expand All @@ -52,10 +52,6 @@ const Styled = styled.span`
fill: ${props =>
props.$active || props.$isLoading ? 'unset' : Theme.inputBorderGray};
}
& * {
height: inherit;
width: inherit;
}
`;

export const useIsMountedRef = () => {
Expand Down
6 changes: 3 additions & 3 deletions src/web/components/panel/infopanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


import React from 'react';

import styled from 'styled-components';

import {isDefined} from 'gmp/utils/identity';

import DeleteIcon from 'web/components/icon/deleteicon';
import XIcon from 'web/components/icon/XIcon';

import {styledExcludeProps} from 'web/utils/styledConfig';
import PropTypes from 'web/utils/proptypes';
Expand Down Expand Up @@ -73,7 +72,7 @@ const InfoPanel = ({
{heading}
{isDefined(onCloseClick) && (
<Button data-testid="panel-close-button" onClick={onCloseClick}>
<DeleteIcon />
<XIcon />
</Button>
)}
</Heading>
Expand All @@ -85,6 +84,7 @@ const InfoPanel = ({
};

InfoPanel.propTypes = {
children: PropTypes.element,
footer: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
heading: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
isWarning: PropTypes.bool,
Expand Down

0 comments on commit 2cce73f

Please sign in to comment.