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

Why is there no "centered" container? #46

Closed
masbaehr opened this issue Dec 30, 2019 · 8 comments
Closed

Why is there no "centered" container? #46

masbaehr opened this issue Dec 30, 2019 · 8 comments

Comments

@masbaehr
Copy link

It would be very useful to have an extra container to show a message at the center of the screen.
It could be implemented very easily by doing the following:

<div class="notification-container-center-center">

.notification-container-center-center {
    transform: translateX(-50%);
    top: 50%;
    left: 50%;
}
@teodosii
Copy link
Owner

teodosii commented Jan 3, 2020

For a very simple reason - it doesn't behave properly for more than 1 notification. When you add a 2nd notification you'll see a sloppy movement because the container gets bigger and needs to be repositioned - BY browser. On the other hand, if we use only:

.center {
  top: 50%;
  left: 50%;
}

Further notifications will not be centered anymore, only the first.

@teodosii
Copy link
Owner

teodosii commented Jan 3, 2020

Hence this is the reason it doesn't exist.

@teodosii teodosii closed this as completed Jan 3, 2020
@masbaehr
Copy link
Author

masbaehr commented Jan 3, 2020

Well to be honest this would be the developer's problem if he chooses to use this. It is merely meant for single short-lived notifications for example like "Access denied" or "OK" - especially where there will never be the case of more than one notification.

@teodosii
Copy link
Owner

teodosii commented Jan 3, 2020

Indeed, it might be helpful in some cases. Will let it open and will get implemented together with the remaining issues.

@teodosii teodosii reopened this Jan 3, 2020
teodosii added a commit that referenced this issue Mar 14, 2020
@teodosii
Copy link
Owner

I've added center container in 2.4.0. Also updated top and bottom containers as they were blurred when being animated due to Chrome treating transforms when animating.

@overcache
Copy link

@teodosii why not publish to npmjs?

@teodosii
Copy link
Owner

@icymind Apparently I forgot to publish, now should be available.

@masbaehr
Copy link
Author

Thanks again for having implemented this!

I noticed however that the container isn't exactly centered, but a bit off (upper side has more white space than bottom side). You'll notice it especially when the screen is 4:3. For example on iPad in portrait mode.

image

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

3 participants