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: add animate support to popovers, add custom origin middleware and animate from reference origin #1194
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated this out into its own component, to match popoverCard.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -105,9 +115,9 @@ export const PopoverCard = memo( | |||
) | |||
|
|||
return ( | |||
<Root | |||
<MotionCard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we're not conditionally creating this motion component – we're always leveraging motion(Card)
even if you don't opt into animate
.
Given that we're not rendering these motion elements as wrappers, it felt simpler to just conditionally attach motion props as needed rather than conditionally define this component. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine – there might be a tiny perf hit, but nothing compared to perf issues already caused by styled-components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful – thank you for this!
…nd animate from reference origin (#1194) * refactor: add clarifying comments * feat: animate tooltips + popovers from reference origin, add custom framer-motion middleware * chore(storybook): add animated menu button story
Description
This PR adds
animate
support forPopover
components.In addition to fading in, animated popovers will now also slightly scale from the reference element's origin, giving the appearance of popovers very slightly 'growing out'. Since this is a popover prop, it's also possible to apply this animation on
<MenuButton>
components too (via thepopover
prop) too.This is done via a custom
origin
middleware which calculates this transform origin offset from both the shifted position and final (not user supplied) floating placement.This middleware is also applied to
<Tooltip>
components too.Currently, there's no optionality around animation here – opting in means you get both opacity + scale transitions, though we may want to provide more fine-grained control in future.
Screenflick.Movie.60.mp4