Skip to content

Add behavior and generic hook for anchored positioning. - #1043

Merged
T-Hugs merged 21 commits into
mainfrom
position
Mar 2, 2021
Merged

Add behavior and generic hook for anchored positioning.#1043
T-Hugs merged 21 commits into
mainfrom
position

Conversation

@T-Hugs

@T-HugsT-Hugs commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

This PR adds a generic behavior for positioning a floating element next to an anchor. For details, see docs.

Play with the behavior: https://codepen.io/team/GitHub/pen/OJbPKNZ

See the rendered documentation. Note: this was intentionally not added to the documentation nav page since we decided to leave these behaviors undocumented until they are used in components.

Closes#1079

Merge checklist

  • Added or updated TypeScript definitions (index.d.ts) if necessary
  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot

changeset-botBot commented Feb 10, 2021

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 53a9703

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercelBot commented Feb 10, 2021

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/EVNXEHNACY2xaj7UCuVCHCZwiHQR
✅ Preview: https://primer-components-git-position-primer.vercel.app

@T-Hugs
T-Hugs marked this pull request as ready for review February 24, 2021 21:00
Comment threaddocs/content/anchoredPosition.mdx Outdated

### Demo

See [this CodePen](https://codepen.io/team/GitHub/pen/OJbPKNZ) for a demo of `useAnchoredPosition`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there any way we can get this demo in the page? I'm worried about this code not staying up to date with the code in the actual useAnchoredPosition hook. Either that or import the hook from the PRC package in codepen

Comment threaddocs/content/anchoredPosition.mdx Outdated
Comment threaddocs/content/anchoredPosition.mdx Outdated
Comment threaddocs/content/anchoredPosition.mdx
Comment threaddocs/content/anchoredPosition.mdx Outdated
Comment threaddocs/content/anchoredPosition.mdx Outdated
Co-authored-by: emplums <emplums@github.com>

@emplumsemplums left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is really great! Just left a few more comments otherwise I think this is ready 2 go (pending more reviews)! Nice work! 🚀

Comment threadsrc/behaviors/anchoredPosition.ts Outdated
Comment threadsrc/stories/useAnchoredPosition.stories.tsx
@T-Hugs
T-Hugs merged commit a184e70 into mainMar 2, 2021
@T-Hugs
T-Hugs deleted the position branch March 2, 2021 20:43
Sign up for freeto 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.

Anchored positioning behavior

2 participants

@T-Hugs@emplums