-
Notifications
You must be signed in to change notification settings - Fork 277
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
Restore default slot and simple tip for Tooltip #7435
Labels
Comments
deboer-tim
added a commit
to deboer-tim/desktop
that referenced
this issue
Jun 3, 2024
Changes - Move 'content' back to be the default slot, since content must always be there and is naturally the visible child. - Make the outer box consistent - i.e. you are welcome to customize the _content_ of tooltips, but the component creates the frame and bg color. - In additional to the 'tip' slot, allow 'tip' to be a property, so in the simple cases you can still do: ``` <Tooltip right tip="some tip"> <something/> </Tooltip> ``` and when you want to totally customize the tip content: ``` <Tooltip right> <something/> <svelte:fragment slot="tip">tip content goes here</svelte:fragment> </Tooltip> ``` If someone accidentally supplies both, the simple tip is used. Having two if-statements is minor duplication, but it is more obvious and avoids extra spaces in the html. I know this undoes a bunch of change and 'tip can either be property or slot' is a bit different (could use different names?), but I think this handles the simple/normal case as easy as before and has a single 'frame', while still allowing for enough customization. Fixes containers#7435. Signed-off-by: Tim deBoer <git@tdeboer.ca>
deboer-tim
added a commit
to deboer-tim/desktop
that referenced
this issue
Jun 5, 2024
Changes - Move 'content' back to be the default slot, since content must always be there and is naturally the visible child. - Make the outer box consistent - i.e. you are welcome to customize the _content_ of tooltips, but the component creates the frame and bg color. - In additional to the 'tip' slot, allow 'tip' to be a property, so in the simple cases you can still do: ``` <Tooltip right tip="some tip"> <something/> </Tooltip> ``` and when you want to totally customize the tip content: ``` <Tooltip right> <something/> <svelte:fragment slot="tip">tip content goes here</svelte:fragment> </Tooltip> ``` If someone accidentally supplies both, the simple tip is used. Having two if-statements is minor duplication, but it is more obvious and avoids extra spaces in the html. I know this undoes a bunch of change and 'tip can either be property or slot' is a bit different (could use different names?), but I think this handles the simple/normal case as easy as before and has a single 'frame', while still allowing for enough customization. Fixes containers#7435. Signed-off-by: Tim deBoer <git@tdeboer.ca>
deboer-tim
added a commit
that referenced
this issue
Jun 6, 2024
Changes - Move 'content' back to be the default slot, since content must always be there and is naturally the visible child. - Make the outer box consistent - i.e. you are welcome to customize the _content_ of tooltips, but the component creates the frame and bg color. - In additional to the 'tip' slot, allow 'tip' to be a property, so in the simple cases you can still do: ``` <Tooltip right tip="some tip"> <something/> </Tooltip> ``` and when you want to totally customize the tip content: ``` <Tooltip right> <something/> <svelte:fragment slot="tip">tip content goes here</svelte:fragment> </Tooltip> ``` If someone accidentally supplies both, the simple tip is used. Having two if-statements is minor duplication, but it is more obvious and avoids extra spaces in the html. I know this undoes a bunch of change and 'tip can either be property or slot' is a bit different (could use different names?), but I think this handles the simple/normal case as easy as before and has a single 'frame', while still allowing for enough customization. Fixes #7435. Signed-off-by: Tim deBoer <git@tdeboer.ca>
deboer-tim
added a commit
to deboer-tim/desktop
that referenced
this issue
Jun 6, 2024
Changes - Move 'content' back to be the default slot, since content must always be there and is naturally the visible child. - Make the outer box consistent - i.e. you are welcome to customize the _content_ of tooltips, but the component creates the frame and bg color. - In additional to the 'tip' slot, allow 'tip' to be a property, so in the simple cases you can still do: ``` <Tooltip right tip="some tip"> <something/> </Tooltip> ``` and when you want to totally customize the tip content: ``` <Tooltip right> <something/> <svelte:fragment slot="tip">tip content goes here</svelte:fragment> </Tooltip> ``` If someone accidentally supplies both, the simple tip is used. Having two if-statements is minor duplication, but it is more obvious and avoids extra spaces in the html. I know this undoes a bunch of change and 'tip can either be property or slot' is a bit different (could use different names?), but I think this handles the simple/normal case as easy as before and has a single 'frame', while still allowing for enough customization. Fixes containers#7435. Signed-off-by: Tim deBoer <git@tdeboer.ca>
cdrage
pushed a commit
to cdrage/podman-desktop
that referenced
this issue
Jun 19, 2024
Changes - Move 'content' back to be the default slot, since content must always be there and is naturally the visible child. - Make the outer box consistent - i.e. you are welcome to customize the _content_ of tooltips, but the component creates the frame and bg color. - In additional to the 'tip' slot, allow 'tip' to be a property, so in the simple cases you can still do: ``` <Tooltip right tip="some tip"> <something/> </Tooltip> ``` and when you want to totally customize the tip content: ``` <Tooltip right> <something/> <svelte:fragment slot="tip">tip content goes here</svelte:fragment> </Tooltip> ``` If someone accidentally supplies both, the simple tip is used. Having two if-statements is minor duplication, but it is more obvious and avoids extra spaces in the html. I know this undoes a bunch of change and 'tip can either be property or slot' is a bit different (could use different names?), but I think this handles the simple/normal case as easy as before and has a single 'frame', while still allowing for enough customization. Fixes containers#7435. Signed-off-by: Tim deBoer <git@tdeboer.ca>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Is your enhancement related to a problem? Please describe
When I went to implement light mode on Tooltip (#6926) I saw that issue #7150 changed it so there are 2 slots (content and tip) and the bg and text colors are replicated on every single instance of Tooltip. We created the component to avoid duplicate code, so we should try to reduce this.
Describe the solution you'd like
Do a few things to make it easier to consume Tooltip:
and when you want to totally customize the tip:
I know the 'tip can either be property or slot' is a bit different (could use different names?), but I think this handles the simple/normal case the easiest while still allowing for customization.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: