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

🪟 🧹 Cleanup Tooltip component usages #15789

Merged
merged 9 commits into from
Aug 23, 2022
Merged

Conversation

edmundito
Copy link
Contributor

@edmundito edmundito commented Aug 19, 2022

What

Followup to #14581

This cleans up the tooltip naming and gets rid of redundant tooltips

  1. Moves ToolTip to components/base/Tooltip
  2. Replaces all ToolTip with tooltip as it's one word
  3. Replaces duplicate tooltips with base/Tooltip
  4. Updates variable input fields component to use the TooltipTable and show tooltip at the top, as designed
  5. Fixes tooltip functionality in the catalog tree and makes the dropdowns look more like dropdowns:
Screen.Recording.2022-08-19.at.08.54.25.mov
  1. Makes InfoTooltip part of base and fixes vertical alignment:
    image

How

Lots of renaming and moving things around replaced styled-components with SCSS.

One thing that was changed in the tooltip was to render it a portal in the body. This allows the tooltip to render correctly even in situations where a parent overflow may be set to hidden, which is what was causing the catalog tree tooltips not to appear. For this, the floating-ui needs autoUpdate.

Recommended reading order

  1. Top to bottom

Tests

  • Storybook
  • Scrolling while tooltip visible
  • Showing different tooltips quickly
  • Variable Input field component in Salesforce source
  • Catalog tree cursor and primary key in connection with Postgres source

@edmundito edmundito added area/frontend area/frontend Related to the Airbyte webapp labels Aug 19, 2022
@edmundito edmundito requested a review from a team as a code owner August 19, 2022 14:00
@github-actions github-actions bot added the area/platform issues related to the platform label Aug 19, 2022
Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

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

Nice refactor! Just had a couple small questions but overall this looks good!

I tried it out locally and the tooltips/dropdowns look like they are working as expected

<Tooltip
control={
<div className={styles.container}>
<div className={styles.icon}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have this intermediate div with its own styling that contains <InfoIcon>, instead of just putting className={styles.icon} on the <InfoIcon> component directly? Can those positioning styles not be applied directly to SVGs or something like that?

flip(),
shift(),
],
whileElementsMounted: autoUpdate,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed because you are now using a portal to place the tooltip on the document.body?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Now it needs to move the tooltip when the user scrolls on the page.

<LineBlock>
<FormattedMessage id="settings.accessManagement.roleEditors" />
</LineBlock>
<InfoTooltip>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice abstraction 👍

@@ -81,11 +72,9 @@ export const PathPopout: React.FC<PathPopoutProps> = (props) => {
placeholder={props.placeholder}
components={props.isMulti ? { MultiValue: () => null } : undefined}
targetComponent={({ onOpen }) => (
<div onClick={onOpen}>
<PathPopoutButton items={props.isMulti ? props.path?.map(pathDisplayName) : props.path} onClick={onOpen}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice refactor, this looks so much better in the UI now! I had thought those dropdowns looked bad for a long while now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a new version of this table in the works, but I figured I give it a little ❤️ until we get there.

Copy link
Contributor

@dizel852 dizel852 left a comment

Choose a reason for hiding this comment

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

Overall - looks good.
Tested locally(not all tooltips)

Also noticed we started getting warning during start webpack dev-server(not significant but would be great to get rid of it)
Screenshot at Aug 22 17-59-56

Copy link
Contributor

@krishnaglick krishnaglick left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -2,9 +2,9 @@ import React from "react";
import { useIntl } from "react-intl";

import { Button } from "components";
import { Tooltip } from "components/base/Tooltip";
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought: Should we rename base to ui?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea: base is really generic, to the point that it doesn't convey much at all except "some of this might get overridden, maybe". ui would make it clearer to me what other components I could expect to find in that directory, which already seems like a win.

@edmundito
Copy link
Contributor Author

@dizel852 good catch on that. I wasn't sure what sass supported but missed the warning.

@edmundito edmundito force-pushed the edmundito/tooltip-cleanup branch from c760b3e to cb93ab2 Compare August 22, 2022 19:10
@teallarson
Copy link
Contributor

teallarson commented Aug 22, 2022

I can't review for some reason. But onFocus should be added in addition to onMouseOver for accessibility (it'll be required once we merge the a11y linting rules). Same with onBlur and onMouseOut.

@edmundito edmundito force-pushed the edmundito/tooltip-cleanup branch from cb93ab2 to e7da1e6 Compare August 23, 2022 12:46
@edmundito
Copy link
Contributor Author

@tealjulia I'm going to separate the a11y focus/blur changes because after giving it a try, it may take some iterations.

@edmundito edmundito merged commit 0910451 into master Aug 23, 2022
@edmundito edmundito deleted the edmundito/tooltip-cleanup branch August 23, 2022 19:00
@edmundito edmundito mentioned this pull request Aug 23, 2022
1 task
rodireich pushed a commit that referenced this pull request Aug 25, 2022
* Temp rename tooltip folder to lowercase

* Move Tooltip to components/base and rename to one word

* Move InfoTooltip to base/Tooltip and eliminate redundancies

* Fix cursor field and primary key dropdowns in the catalog tree, remove duplicate tooltip

* Update ArraySection to show tooltip at the top
Update ArrayOfObjectsEditor to render description with TooltipTable

* Update InfoTooltip to SCSS, ensure that it's centered aligned

* Ensure that Tooltips auto update on scroll

* Add TooltipLearnMoreLink to Tooltip index and update imports

* Fix InfoTooltip icon math in SCSS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants