Currently, the Tooltip component is not inherently connected to anything. We pass it a handler and presume that this handler interacts with the Tooltip.
In the current only use case (see components/Workout/NewWOrkout/sub/NewExercise), the tooltip works as follows:
we define a boolean state, showInfo
we add a button that calls setShowInfo(true) on click
In this implementation, the trigger button, Tooltip, and render condition, are implemented completely separately.
I'm wondering if there is a way to rework the tooltip functionality so that we can get the necessary state, handlers and element from one place instead of having to manually define these things everywhere.
Trade-offs
pro: less duplication
con: less control
How far should the coupling go? We want to maintain the option to render a tooltip anywhere on the page, regardless of where the trigger element is placed. We also might want to utilize different methods of interacting with the tooltip. Should these be props, or do we want to attain full control of this on a per-use case basis?
[WIP]
Intent
Currently, the
Tooltip
component is not inherently connected to anything. We pass it a handler and presume that this handler interacts with theTooltip
.In the current only use case (see
components/Workout/NewWOrkout/sub/NewExercise
), the tooltip works as follows:showInfo
setShowInfo(true)
on clickIn this implementation, the trigger button, Tooltip, and render condition, are implemented completely separately.
I'm wondering if there is a way to rework the tooltip functionality so that we can get the necessary state, handlers and element from one place instead of having to manually define these things everywhere.
Trade-offs
pro: less duplication
con: less control
How far should the coupling go? We want to maintain the option to render a tooltip anywhere on the page, regardless of where the trigger element is placed. We also might want to utilize different methods of interacting with the tooltip. Should these be props, or do we want to attain full control of this on a per-use case basis?