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(Toast): improve animation #2391

Merged
merged 12 commits into from
Sep 29, 2024
Merged

feat(Toast): improve animation #2391

merged 12 commits into from
Sep 29, 2024

Conversation

talkor
Copy link
Member

@talkor talkor commented Aug 26, 2024

@talkor talkor requested a review from a team as a code owner August 26, 2024 15:46
Copy link
Contributor

@YossiSaadi YossiSaadi left a 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 🙏🏼

@talkor talkor requested a review from YossiSaadi September 22, 2024 06:49
packages/core/src/components/Toast/__stories__/Toast.mdx Outdated Show resolved Hide resolved
Comment on lines +135 to +142
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;
}, []);
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Member Author

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]>
@talkor talkor merged commit 968c852 into master Sep 29, 2024
10 checks passed
@talkor talkor deleted the toast-animation branch September 29, 2024 17:58
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.

2 participants