Skip to content

feat: added toast component#17

Merged
anuraghazra merged 6 commits intomasterfrom
feat/toast
Sep 8, 2020
Merged

feat: added toast component#17
anuraghazra merged 6 commits intomasterfrom
feat/toast

Conversation

@anuraghazra
Copy link
Copy Markdown
Contributor

No description provided.

@netlify
Copy link
Copy Markdown

netlify Bot commented Sep 4, 2020

Deploy preview for renderless-components ready!

Built with commit f44c1a1

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

Comment thread package.json
Comment thread package.json Outdated
Comment thread src/toast/ToastContext.ts Outdated
Comment thread src/toast/ToastContext.ts Outdated
Comment thread src/toast/ToastProvider.tsx Outdated
Comment thread src/toast/ToastState.ts Outdated
Comment thread src/toast/ToastState.ts Outdated
Comment thread src/toast/ToastState.ts Outdated
Comment thread src/toast/ToastState.ts
Comment thread src/toast/ToastProvider.tsx Outdated
@navin-moorthy
Copy link
Copy Markdown
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.

Comment thread src/toast/stories/Animations.stories.tsx Outdated
@anuraghazra
Copy link
Copy Markdown
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
Copy Markdown
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