Skip to content

Commit

Permalink
fix: Fix known exploit label always being compact (#1539)
Browse files Browse the repository at this point in the history
* fix: Fix known exploit label always being compact

* Update snapshot
  • Loading branch information
leSamo authored Feb 9, 2022
1 parent a438224 commit b37cdce
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ exports[`KnownExploitSummary component Should match snapshot. 1`] = `
]
}
color="red"
isCompact={true}
style={Object {}}
>
<Memo(MemoizedFormattedMessage)
Expand All @@ -228,11 +227,10 @@ exports[`KnownExploitSummary component Should match snapshot. 1`] = `
]
}
color="red"
isCompact={true}
style={Object {}}
>
<span
className="pf-c-label pf-m-red pf-m-compact cve-labels pf-u-mr-sm"
className="pf-c-label pf-m-red cve-labels pf-u-mr-sm"
style={Object {}}
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CSAwLabel from './CSAwLabel';

const GroupedCVELabels = ({ hasExploit, hasRule, isCompact }) =>
(hasExploit || hasRule) && (
<LabelGroup className="pf-u-mt-xs cve-labels-grouped--nowrap">
<LabelGroup className="cve-labels-grouped--nowrap">
{hasExploit && <KnownExploitLabel isCompact={isCompact}/>}
{hasRule && <CSAwLabel isCompact={isCompact}/>}
</LabelGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import messages from '../../../Messages';

const KnownExploitLabel = ({ style, className }) => (
const KnownExploitLabel = ({ style, className, isCompact }) => (
<Tooltip content={<FormattedMessage {...messages.knownExploitDescription} />}>
<Label color="red" style={{ ...style }} className={['cve-labels', className]} isCompact>
<Label color="red" style={{ ...style }} className={['cve-labels', className]} isCompact={isCompact}>
<FormattedMessage {...messages.knownExploit} />
</Label>
</Tooltip>
);

KnownExploitLabel.propTypes = {
style: PropTypes.object,
className: PropTypes.string
className: PropTypes.string,
isCompact: PropTypes.bool
};

export default KnownExploitLabel;
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ span {

.cve-labels-grouped--nowrap {
flex-wrap: nowrap;
margin-top: 2px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ exports[`KnownExploitLabel component Should match snapshot 1`] = `
]
}
color="red"
isCompact={true}
style={Object {}}
>
<Memo(MemoizedFormattedMessage)
Expand All @@ -136,11 +135,10 @@ exports[`KnownExploitLabel component Should match snapshot 1`] = `
]
}
color="red"
isCompact={true}
style={Object {}}
>
<span
className="pf-c-label pf-m-red pf-m-compact cve-labels"
className="pf-c-label pf-m-red cve-labels"
style={Object {}}
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7058,7 +7058,7 @@ exports[`SystemCvesTable Should match snapshots 1`] = `
<LabelGroup
aria-label="Label group category"
categoryName=""
className="pf-u-mt-xs cve-labels-grouped--nowrap"
className="cve-labels-grouped--nowrap"
closeBtnAriaLabel="Close label group"
collapsedText="\${remaining} more"
defaultIsOpen={false}
Expand All @@ -7076,7 +7076,7 @@ exports[`SystemCvesTable Should match snapshots 1`] = `
prefix="pf-random-id-"
>
<div
className="pf-c-label-group pf-u-mt-xs cve-labels-grouped--nowrap"
className="pf-c-label-group cve-labels-grouped--nowrap"
>
<div
className="pf-c-label-group__main"
Expand Down

0 comments on commit b37cdce

Please sign in to comment.