-
Notifications
You must be signed in to change notification settings - Fork 323
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(Toast): improve animation #2391
Conversation
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.
The animation looks really neat!
I had a few questions about breaking changes 🙏🏼
packages/core/src/components/Toast/__stories__/Toast.stories.tsx
Outdated
Show resolved
Hide resolved
const recalculateElementWidth = useCallback((element: HTMLElement) => { | ||
const prevWidth = element.style.width; | ||
element.style.width = "auto"; | ||
const endWidth = getComputedStyle(element).width; | ||
element.style.width = prevWidth; | ||
element.offsetWidth; // force repaint | ||
element.style.width = endWidth; | ||
}, []); |
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.
damn. how heavy is this one? how many times does it gets triggered?
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.
it is an 11 years article btw, 100% still relevant?
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.
Unfortunately yes, there's no way to animate width and max-width will apply only when the width increases
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.
It's only called once and when the text changes so I don't think it's heavy
Co-authored-by: Yossi Saadi <[email protected]>
https://monday.monday.com/boards/3532714909/pulses/7111634626
https://monday.monday.com/boards/3532714909/pulses/7359815024