Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Shield): remove Unknown question mark icon #2154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/components/src/Shield/Shield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@ export interface ShieldProps {
impact: keyof typeof impactList | 'N/A';
hasLabel?: boolean;
hasTooltip?: boolean;
disableQuestionIcon?: boolean;
size?: IconComponentProps['size'];
}

const Shield: React.FunctionComponent<ShieldProps> = ({ impact = 'N/A', hasLabel = false, size = 'md', hasTooltip = true }) => {
const Shield: React.FunctionComponent<ShieldProps> = ({
impact = 'N/A',
hasLabel = false,
size = 'md',
hasTooltip = true,
disableQuestionIcon = false,
}) => {
const attributes = impactList?.[impact as keyof typeof impactList] ?? impactList.Unknown;
const badgeProps: SVGIconProps = {
'aria-hidden': 'false',
'aria-label': attributes.title,
color: attributes.color,
};

const badge = <Icon size={size}>{attributes.title === 'Unknown' ? <QuestionIcon {...badgeProps} /> : <SecurityIcon {...badgeProps} />}</Icon>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to add a prop to show an icon and which icon, since there might be places where we actually do want to show an icon.

The default behaviour should still remain the same.

const badge = (
<Icon size={size}>
{attributes.title === 'Unknown' ? disableQuestionIcon ? null : <QuestionIcon {...badgeProps} /> : <SecurityIcon {...badgeProps} />}
</Icon>
);

const body = (
<span>
Expand Down