-
Notifications
You must be signed in to change notification settings - Fork 28
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
Migration to v3 from v1 #13
Comments
Is it the same class name value for /*
This instance handles the default tooltips.
*/
<ReactHint events delay={100} />
/*
This instance handles the new tooltips.
*/
<ReactHint
/*
Re-define the default `data-rh` tooltip attribute
name to distinguish between two tooltip types.
*/
attribute="data-custom-attribute-name"
/*
Set the default class name to be the same
as for `data-rh-cls`.
*/
className="custom-class-name"
/*
Set the show delay to match the default value
for react-hint v.1.
*/
delay={100}
/*
Don't forget to enable events. You can specify
which types of events trigger the tooltip, e.g.
click, focus, hover.
*/
events={{hover: true, click: false}}
/*
Add this property in case you want to retain
the usual behaviour, so the tooltip won't hide
if you hover over it.
*/
persist
/>
...
/*
This element will trigger the default tooltip.
*/
<div data-rh="Default tooltip" />
/*
This element will trigger the new tooltip with
the custom styling.
*/
<div data-custom-attribute-name="New tooltip" /> Does it solve your case? If not, we'll figure it out :) |
Thank you for a quick reply! Your solution works! As you assumed we use the same class name for one half of components. I faced two problems while adopting v3:
<div class="react-hint--tip react-hint react-hint--tip react-hint--top">
<div class="react-hint--tip react-hint__content">New tooltip</div>
</div> It's not a big problem for us, but I though you would like to know. |
Hm, I see your point. I guess this can be solved by splitting the class name by whitespace and attaching a postfix to each of the resulting classes, e.g. <div class="react-hint--tip react-hint react-hint--tip--top react-hint--top">
<div class="react-hint--tip__content react-hint__content">New tooltip</div>
</div> Do you think this will be better? I am open to proposals if you have any. |
Current implementation allows to rename block. With class name <div class="block-name block-name--top">
<div class="block-name__content">New tooltip</div>
</div> And it's good. It solve namespace problem. I think you shouldn't change anything. With following code I could achieve desired results (not ideal, but works :)): <ReactHint
className="react-hint--tip react-hint"
onRenderContent={(target, content) => (
<div className="react-hint__content">{content}</div>
)}
/> <div class="react-hint--tip react-hint react-hint--tip react-hint--top">
<div class="react-hint__content">New tooltip</div>
</div> Thank you for your help! |
I am so lost as to how to do two custom rendered react hint's Whenever I hover over my container to pop up the hint object, both of my tooltips show at the same time and start showing my videos in my custom render. It seems I am stuck for the evening with 1 tool tip per page until I can figure out how the heck these custom classes go together so that one container is isolated to it's own thing. Here's some files to help you understand how I am using it: Callers:
ToolTipVideo class:
And the ReactHint
Here are the two divs hovered over at the same time. Start: As hovering over the top help icon (the videos both run and both divs are showing up... if you notice the two grey boxes those are two instances of a video object but with different videos popping up when I hover over one): FYI this library will be used in our help videos for Atlona velocity, but only if I can figure out how to load multiple tips in one page without all of them opening up at the same time. (Desperate for help to get this project out of my hair so I can be onto more interesting things than hover popups!) LOL! Overall I think once I understand how these custom classes work, I will be sending a pull request with some better documentation. |
@slmgc sorry to comment on a closed issue. I can add as a separate issue if you'd like? |
Hi @davidrenne, I am really sorry to hear that you have so much trouble dealing with multiple I believe the issues is that every wrapper instance uses the same hard-coded If you'll check my topmost comment here: #13 (comment), it describes what needs to be done there, let me quote myself: <ReactHint
/*
Re-define the default `data-rh` tooltip attribute
name to distinguish between two tooltip types.
*/
attribute="data-custom-attribute-name" So, all you need to do is to define a unique <ReactHint attribute="data-custom-attribute-name-for-the-first-instance"
...
/>
/* If it's really required to show completely different-looking tooltips
for some edge cases, you define a second instance */
<ReactHint attribute="data-custom-attribute-name-for-the-second-instance"
...
/> Though, it will solve your issue, I believe there might be a misunderstanding of how Hope this helps! |
@slmgc u rock! ill check it out in the morning and see if I can get it working. Yea I think if I have 1 node of reacthint maybe ill have less issues. Thanks for a quick response. Ill let you know if i get it working tomorrow. |
@slmgc Yea I just dont get how it can be a singleton node. You pass a function onRenderContent for a custom render to render the inside of the div when the popup shows. I did actually try to change the attribute={} prop to a unique one, but whenever I change it to anything but "data-custom" the help icons disappear on me. I am not sure how multiple nodes showing different videos would actually be able to pass different functions for a custom Render. I think I may need to rethink and not use onRenderContent because I dont understand how onRenderContent can be used to show different things. I need to go back to the drawing board and output a render through inline HTML somehow and referencing those classNames somehow into the singleton. I still am lost as to how can you have two different tool tips with a single node? How is it possible to have two nodes with two different classes? Should a developer somehow set state as someone hovers over their hover node to change the |
I think I got it figured out. I think my case is the 0.01 case because each popup has unique content onRender. When my tip is a function I merely generate a unique tip ID from the video URL
It probably never showed up because I was changing just the attribute inside of the ReactHint and not adjusting the above block of code to match it. Here's the full file which is not isolating each popup properly.
|
@davidrenne I still don't get it when you say "I think my case is the 0.01 case because each popup has unique content onRender." Does it mean every tooltip looks completely different with custom css styling? Or is it about custom content only? Because if it's about content with the same-looking tooltip, then it means that you are probably overcomlicating things. "Yea I just dont get how it can be a singleton node." Have you tried using a single ReactHint instance without adding your custom wrapper? You can easily override |
Yea I think i am overcomplicating, but it works right now with spawning off a unique node or attribute for each popup with a different video of content using a different onRenderContent. Thanks for listening and helping me out! Nice library which floats in a nice position each time with minimal changes to styling. |
I'll try to come up with an example for you to be used with your video tooltips, maybe it will help you as creating a new |
That would be delicious. So far performance wise, its like instantaneous for my small use case of a video tag. I do know why probably you went into the singleton direction. Node rendering seems to be most CPU intensive the more nodes you have on re-renders. Like for example SVG's we found are super slow compared to a simple img tag with a png. But you lose the benefits of color controls etc. Thanks for showing me the light on my example as to how I would implement it and I can try it out in our project once you guide me a bit. To me, it was just confusing as to how to interface and inject new videos into the tree of the rendered popup. Thanks for being awesome @slmgc |
Currently we use react-hint@1.3.1. We have
<ReactHint />
in top container component to avoid conflicts with multiple instances in v1. Half of our components usedata-rh-cls
. Is there a strategy how to migrate to v3 when only half of components usesdata-rh-cls
?Is this possible to get back
data-rh-cls
back, which was deprecated in 2.0.0?Thank you for your library!
The text was updated successfully, but these errors were encountered: