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

New Component | Annotation (attachment, facehugger, metroid, or other name) #315

Open
aVileBroker opened this issue Aug 31, 2021 · 1 comment
Labels
2 Story Points 2 Story Points help wanted Extra attention is needed new component New base component

Comments

@aVileBroker
Copy link
Contributor

aVileBroker commented Aug 31, 2021

This is a component which is fixed in position, and "attaches" itself to a component by ref. It could be rendered in a portal - we could probably do a ternary to control it, like <renderInPortal ? Portal : Fragment> .

It behaves similarly to the dropdown currently does, in that it will "flip" when it runs out of space. Ideally this should be used in Dropdown as well to replace the current intersectionObserver logic, and in doing so also complete #255 at the same time.

Props API:

  • preferredPlacement?: 'above' | 'right' | 'bottom' | 'left';
  • preferredAlignment?: 'start' | 'center' | 'stretch' | 'end';
  • renderInPortal: boolean;
  • StyledContainer?: StyledSubcomponent;

Given the preferred placement/alignment provided by the props - it should follow those unless it runs out of space, in which case it should "flip". I don't see the need to "flip" to center or stretch, but feel free to prove me wrong.

Rationale

I began writing this component as part of the Spotlight component for showing an annotation around the spotlight which tries to always stay in-view. When it goes near the right of the screen, it flips to the left. When it goes towards the bottom, it flips up, etc.

This is also useful for tooltips, and I'm sure our users will find other use-cases as well. This is not a simple problem to fix - which is exactly why having a component like this would make foundry powerful and sought-after.

If there is a library out there which we like, and isn't too large, I'm open to suggestion for simplifying this and potentially negating the need for it at all.

@aVileBroker aVileBroker added help wanted Extra attention is needed new component New base component 2 Story Points 2 Story Points labels Aug 31, 2021
@aVileBroker aVileBroker added this to Backlog in Foundry-react-UI via automation Aug 31, 2021
@joien1 joien1 self-assigned this Sep 3, 2021
@aVileBroker aVileBroker moved this from Backlog to Priority to do in Foundry-react-UI Sep 10, 2021
@dawsonbooth dawsonbooth self-assigned this Oct 22, 2021
@PatrickDeVries PatrickDeVries moved this from Priority to do to In progress in Foundry-react-UI Oct 25, 2021
@aVileBroker
Copy link
Contributor Author

I would love to also see a mobile friendly version of this, where the annotation goes full width (w/ gutters) and only clamps to the bottom/top of the elements.

Same could be done for tight landscape views, where the annotation is full height and clamps to the left/right sides of the target

@dawsonbooth dawsonbooth removed their assignment Apr 8, 2022
@dawsonbooth dawsonbooth moved this from In progress to Priority to do in Foundry-react-UI Apr 8, 2022
@aVileBroker aVileBroker reopened this Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 Story Points 2 Story Points help wanted Extra attention is needed new component New base component
Projects
Status: Done
Foundry-react-UI
  
Priority to do
Development

No branches or pull requests

3 participants