-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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(snackbar): allow snack bar to be positioned on the page #4045
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, I think I would want to make this more general before adding more positions
8932bc7
to
6be0d6d
Compare
@jelbourn and @josephperrott so this is going to be only left of center at first? |
b1a462c
to
d9f16e9
Compare
@jelbourn ready for you to take a look |
@@ -1,6 +1,11 @@ | |||
import {ViewContainerRef} from '@angular/core'; | |||
import {AriaLivePoliteness} from '../core'; | |||
|
|||
export interface MdSnackBarPosition { | |||
horizontal: string; | |||
vertical: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types for these should be a string literal enumeration
@@ -19,4 +24,10 @@ export class MdSnackBarConfig { | |||
|
|||
/** Extra CSS classes to be added to the snack bar container. */ | |||
extraClasses?: string[]; | |||
|
|||
/** The position to place the snack bar in the view, either 'left' or 'center'. */ | |||
position?: MdSnackBarPosition = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of want this to be two separate properties (verticalPosition
and horizontalPosition
)- it gives you the freedom to set just one if you want (easier defaults). Do you have a reason for making it a separate object?
max-width: $mat-snack-bar-max-width; | ||
min-width: $mat-snack-bar-min-width; | ||
padding: $mat-snack-bar-padding; | ||
// Initial transformation is applied to start snack bar out of view. | ||
transform: translateY(100%); | ||
|
||
&.md-snack-bar-center { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add description comments for when these classes are applied / what they're used for
src/lib/snack-bar/snack-bar.ts
Outdated
.bottom('0'); | ||
let positionStrategy = this._overlay.position().global(); | ||
switch (config.position.horizontal) { | ||
case 'left': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be start
and end
instead of left
and right
, taking the RTL/LTR state into account
src/lib/snack-bar/snack-bar.ts
Outdated
case 'bottom': | ||
positionStrategy.bottom('0'); | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need unit test for using the appropriate position based on the config and ltr/rtl state
|
||
if (this.snackBarConfig.position.vertical === 'top') { | ||
this._renderer.setElementClass(this._elementRef.nativeElement, 'md-snack-bar-top', true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need unit tests for setting these css classes when appropriate
08f89e3
to
a747c07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes , can we get this merged ASAP
@jelbourn & @josephperrott would this just be in the next build or will be available on master branch anytime in the future |
please rebase |
Is this going to make it into the next build? I'm really waiting for this feature. @josephperrott |
I hope next build come with this changes. |
This release is taking longer than expected. Any idea when the next release is? |
2f9d448
to
368b4a9
Compare
35f70d5
to
05c0854
Compare
@jelbourn rebased and ready to be looked at. |
@josephperrott can you rebase again? |
05c0854
to
5f96375
Compare
@jelbourn Rebased and ready to go. |
+1 merge please |
@jelbourn && @josephperrott did this end up making it into the latest build? If not, is there a new holdup for this feature? |
This should be in beta.11 |
@jelbourn yea!!! I looked in the release notes and didn't see it. |
How can we change the position/location of snackbar? |
@ORESoftware have a look at this https://angular-vv8kca.stackblitz.io. |
ah yes thanks |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
For #3577