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

8px off the top #44

Closed
stephenfeather opened this issue Oct 15, 2017 · 2 comments
Closed

8px off the top #44

stephenfeather opened this issue Oct 15, 2017 · 2 comments

Comments

@stephenfeather
Copy link

Great little add on. Well implemented as well. Not needing to pass context or props around to reach the primary placement was excellent thinking.

Testing in Chrome Dev using React 16, the toast is sitting 8px down from the top. If I hack the bin and set the y transform to -100 instead of -108, its fixed.

What was the original thinking behind the 108 offset? Want to be sure I'm not going to run into any side effects you already dealt with before setting to 108.

Thanks.

@jesusoterogomez
Copy link
Owner

jesusoterogomez commented Oct 19, 2017

Thanks for the kind words!

I've seen your comment in the other post as well, and I have to admit that I really hate this magic hardcoded value, and that I really don't remember the reasoning behind it, as I started this project as a really small add-on to a really old project in Angular and when I ported it, and this value was put there after some trial and error with that specific project.

I have been struggling with multiline notifications this week, so I am thinking of getting rid of this value altogether.

I don't have a lot of time to implement it soon, but my idea is:

  1. Load and measure height of the content into the notification's DOM element
  2. Use that height for the translateY animations.
  3. ???
  4. Profit!

This would make every translateY dynamic to the content of each notification, and I believe it would solve the multiline problem.

This might also require some positioning work to change the container's initial placement.

@jesusoterogomez
Copy link
Owner

I think I may have solved this problem in a simpler way, but I need help to test if it fixes the problem for you (or other use cases). I will create a PR shortly.

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

No branches or pull requests

2 participants