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: added toast component #17

Merged
merged 6 commits into from
Sep 8, 2020
Merged

feat: added toast component #17

merged 6 commits into from
Sep 8, 2020

Conversation

anuraghazra
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Sep 4, 2020

Deploy preview for renderless-components ready!

Built with commit f44c1a1

https://deploy-preview-17--renderless-components.netlify.app

package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/toast/ToastContext.ts Outdated Show resolved Hide resolved
src/toast/ToastContext.ts Outdated Show resolved Hide resolved
src/toast/ToastProvider.tsx Outdated Show resolved Hide resolved
src/toast/ToastState.ts Outdated Show resolved Hide resolved
src/toast/ToastState.ts Outdated Show resolved Hide resolved
src/toast/ToastState.ts Outdated Show resolved Hide resolved
src/toast/ToastState.ts Show resolved Hide resolved
src/toast/ToastProvider.tsx Outdated Show resolved Hide resolved
@navin-moorthy
Copy link
Collaborator

Can't we somehow utilize, onAnimationEnd from the Animation Components and make the Toast hide after that.

I haven't seen any library getting two timeouts, will try to experiment with that to see if we can remove the prop itself.

@anuraghazra
Copy link
Contributor Author

anuraghazra commented Sep 8, 2020

Can't we somehow utilize, onAnimationEnd from the Animation Components and make the Toast hide after that.

I haven't seen any library getting two timeouts, will try to experiment with that to see if we can remove the prop itself.

Yeah we can do that, but there are few gotchas with that.
What we are trying to achieve is that so users have full control over all the animation logic.

So,

onAnimationEnd - would only work with CSS Animation

Then we also have to handle transition animations (react-transition-group's Transition component uses it)

onTransitionEnd - would only work with CSS Transition. (not to mention this would prevent us to add any hover effects to the component since onTransitionEnd would fire on that too)

And also note that, not all animations are CSS & Transition, there are some libraries which uses javascript animations (react-spring) and they won't work with onAnimationEnd/onTransitionEnd listeners, they have their own callback apis.
So this is why we cannot approach the onAnimationEnd method.

We can also do one thing is that totally handover the toast removing logic after animation end to user, this way we won't handle the logic but then users would have to know how things work and that they have to remove the toast after animation finishes.

@navin-moorthy
Copy link
Collaborator

LGTM 🎉

@anuraghazra anuraghazra merged commit 1b18d05 into master Sep 8, 2020
@anuraghazra anuraghazra added the component ⚙️ Issues or PR about a specific component API label Sep 10, 2020
@anuraghazra anuraghazra deleted the feat/toast branch September 21, 2020 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component ⚙️ Issues or PR about a specific component API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants