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

Make Label Cursor Hoverable #3332

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ enum ConditionStatus {
True = 'True',
False = 'False',
}

interface ModelRegistryTableRowStatusProps {
conditions: K8sCondition[] | undefined;
}
Expand Down Expand Up @@ -118,8 +117,23 @@ export const ModelRegistryTableRowStatus: React.FC<ModelRegistryTableRowStatusPr
}
}

const isClickable = popoverTitle && popoverMessages.length;

const label = (
<Label data-testid="model-registry-label" icon={icon} color={color} isCompact>
<Label
{...(isClickable
? {
onClick: () => {
Copy link
Contributor

@manaswinidas manaswinidas Oct 17, 2024

Choose a reason for hiding this comment

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

not sure if we should prefer this over style={{ cursor: 'pointer' }} 🤔
(inspiration from #3344 - let me know if this works though.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's already looks like the hand pointer, just like in the video. Or is it a different way we want it to look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to add that style but it's not changing anything from what I see - it remains the pointing hand ( like in the picture but just white and slightly bent)
Screenshot 2024-10-17 at 12 29 18 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe the suggestion was to avoid the noop function, but I think it's probably fine either way - inline styles are also not great 🤷

@YuliaKrimerman can you just add more detail to the comment in that noop function, something like "Click event is handled by the Popover parent, this prop enables clickable styles in the PatternFly Label"?

/* intentional no-op - Click event is handled by the Popover parent,
this prop enables clickable styles in the PatternFly Label */
},
}
: {})}
data-testid="model-registry-label"
icon={icon}
color={color}
isCompact
>
{statusLabel}
</Label>
);
Expand Down
Loading