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

Support passing tooltip content to menu item by tooltipContent prop #551

Merged
merged 6 commits into from
Feb 22, 2022

Conversation

etaylib
Copy link
Contributor

@etaylib etaylib commented Feb 21, 2022

tooltip is shown only for disabled and disabled reasons. Adding support for plain tooltip content.

image

const tooltipContent = disabled ? disableReason : title;
const shouldShowTooltip = isTitleHoveredAndOverflowing || disabled || tooltipContent;

const getTooltipContent = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to put this logic inside a function which will create for each render.
you can set this logic as regular code inside the component.
If the logic were complex I would suggest use memo but it's only few conditions

@etaylib etaylib requested a review from hadasfa February 22, 2022 10:23
@hadasfa hadasfa merged commit 5d08247 into master Feb 22, 2022
@hadasfa hadasfa deleted the feature/etay/menu-item/support-tooltip branch February 22, 2022 12:38
@hadasfa hadasfa changed the title support passing tooltip content without disabled mode Support passing tooltip content to menu item by tooltipContent prop Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants