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(tooltip): implement tooltip to beta phase #882

Closed
wants to merge 6 commits into from

Conversation

cwoolum
Copy link
Contributor

@cwoolum cwoolum commented Jul 11, 2024

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests
  • Other

Why is it needed?

Implements #853

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have ran pnpm change and documented my changes
  • I have add necessary docs (if needed)
  • Added new tests to cover the fix / functionality

Copy link

changeset-bot bot commented Jul 11, 2024

🦋 Changeset detected

Latest commit: d401c37

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@qwik-ui/headless Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cwoolum cwoolum changed the title feat(tooltip): implement tooltip to beta phase feat(tooltip): implement tooltip to beta phase [WIP 🚧] Jul 11, 2024
Copy link

pkg-pr-new bot commented Jul 11, 2024

commit: d401c37

npm i https://pkg.pr.new/qwikifiers/qwik-ui/@qwik-ui/headless@882
npm i https://pkg.pr.new/qwikifiers/qwik-ui/@qwik-ui/styled@882
npm i https://pkg.pr.new/qwikifiers/qwik-ui@882
npm i https://pkg.pr.new/qwikifiers/qwik-ui/@qwik-ui/utils@882

Open in Stackblitz

hover={true}
bind:anchor={triggerRef}
floating={placement}
id={localId}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where should localId actually go?

Copy link
Collaborator

@thejackshelton thejackshelton Jul 13, 2024

Choose a reason for hiding this comment

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

localId is the "same id" across the headless component. it's usually for when you have 1:1 components. Such as one trigger, one input, one root, etc.

Then you can prefix these in any file with a new variable:

const inputId = `${context.localId}-input`

And the component knows you are referring to that instances input, as long as the id prop is passed to the input JSX

@cwoolum
Copy link
Contributor Author

cwoolum commented Aug 1, 2024

@thejackshelton , implemented onOpenChange and removed animations from the docs. Let me know what you think.

@cwoolum cwoolum changed the title feat(tooltip): implement tooltip to beta phase [WIP 🚧] feat(tooltip): implement tooltip to beta phase Aug 2, 2024
const placements = ['top', 'right', 'bottom', 'left'] as const;

test.describe('Tooltip Placements', () => {
placements.forEach((placement) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

sometimes generated tests from a loop are harder to debug

An alternative approach is to encapsulate all of the setup in a dedicated setup function for this test (for example, everything until line 92 and just create this test 4 time and call the "custom setup" function with a param for the placement.

It's not a must, but it might be easier to debug if we'll run into issues in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored some helpers into the driver split out the different cases.

@shairez
Copy link
Contributor

shairez commented Aug 7, 2024

Great job @cwoolum ! 👏

Left one comment, other than that, LGTM! 🙏

@thejackshelton
Copy link
Collaborator

closing #882 in favor of #934 which builds upon this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants