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

feat(react): add toggletip component #10365

Merged

Conversation

joshblack
Copy link
Contributor

@joshblack joshblack commented Jan 7, 2022

Closes #10280

Adds the toggletip set of components to this project. This is the initial API Design for Toggletip and its corresponding components. It includes test stubs but no tests yet for the implementation while we go through API review 👀

Changelog

New

  • Add Toggletip components
  • Add useWindowEvent to useEvent

Changed

  • Update useEvent to supports refs

Removed

Testing / Reviewing

  • Go through the API design for this component
    • Does it make sense?
    • Does it follow our standards?
    • Do you see any problems with it?
  • Go through the test stubs, do you see any behavior that should be covered that isn't?

@netlify
Copy link

netlify bot commented Jan 7, 2022

✔️ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: 32152dd

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/61f0642987d7e700070c3660

😎 Browse the preview: https://deploy-preview-10365--carbon-react-next.netlify.app

@netlify
Copy link

netlify bot commented Jan 7, 2022

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: 32152dd

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/61f06429d43b8b00070d350c

😎 Browse the preview: https://deploy-preview-10365--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Jan 7, 2022

✔️ Deploy Preview for carbon-components-react ready!
Built without sensitive environment variables

🔨 Explore the source changes: 32152dd

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/61f064294aaa57000944505a

😎 Browse the preview: https://deploy-preview-10365--carbon-components-react.netlify.app

@joshblack joshblack marked this pull request as ready for review January 14, 2022 21:32
@joshblack joshblack requested a review from a team as a code owner January 14, 2022 21:32
Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Looks good to me! Composing ToggletipLabel outside of Toggletip looks a bit strange but I like the preference towards flexibility.

packages/react/src/components/Toggletip/index.js Outdated Show resolved Hide resolved
packages/react/src/internal/useEvent.js Show resolved Hide resolved
@joshblack joshblack requested review from abbeyhrt and laurenmrice and removed request for kingtraceyj January 19, 2022 21:51
Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

  • The hover state for the icon looks like its $icon-primary, so that is correct. 👍

  • There should be 8px between the top of the caret tip and info icon.
    toggletip spacing

  • The focus on the link and button inside of the popover container need to be using $focus-inverse.
    toggletip focus


  • Also just a question, are direction for top, bottom, left, and right going to be provided eventually? Or should they be a part of this PR.

Copy link
Contributor

@abbeyhrt abbeyhrt left a comment

Choose a reason for hiding this comment

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

Looks good to me!!

@joshblack
Copy link
Contributor Author

@laurenmrice thanks for the review! Just updated with the changes. I also included a "playground" story with the directions (although the "top" option will run into the top of the page, will figure out a good way to center stories in a future PR).

Separately, it looked like the button was using the correct token but let me know if you still are seeing that problem in the latest update!

@joshblack joshblack requested a review from laurenmrice January 24, 2022 19:50
@laurenmrice
Copy link
Member

@joshblack The $focus-inverse looks good in the light themes. But for the dark themes, the button still gets incorrect focus styling. The focus around the button should be blue and not white.

In storybook:
Screen Shot 2022-01-25 at 11 08 53 AM

@joshblack
Copy link
Contributor Author

@laurenmrice great point, thanks! I'll make an update today

@joshblack
Copy link
Contributor Author

@laurenmrice just pushed up the change so that the button uses $focus-inverse. Let me know if that worked!

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

It looks good to me now! 👍

Side note: Eventually design is going to add another focus color token for $focus-inset that is inverse for these situations when a button appears on an inverse background. It will help improve some of the color contrast.

@kodiakhq kodiakhq bot merged commit 7ef288a into carbon-design-system:main Jan 25, 2022
@abbeyhrt abbeyhrt mentioned this pull request Jan 27, 2022
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToggleTip
4 participants