-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(snack-bar): use mat-button like styling in simple snack bar #7506
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
Conversation
@@ -16,6 +16,14 @@ $mat-snack-bar-button-margin: 48px !default; | |||
background: none; |
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.
It doesn't let me set a comment on the proper line, but you should be able to get rid of the @include mat-button-reset
a little bit above.
@@ -16,6 +16,14 @@ $mat-snack-bar-button-margin: 48px !default; | |||
background: none; | |||
flex-shrink: 0; | |||
margin-left: $mat-snack-bar-button-margin; | |||
line-height: 20px; |
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.
Is this used for centering? Couldn't we use flexbox instead?
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.
See other comment
|
||
.mat-button-ripple, | ||
.mat-button-focus-overlay { | ||
height: 36px; |
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.
Why does this have to override the height
and top
? AFAIK the overlay and ripple are supposed to be width: 100%
and height: 100%
of the button?
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 issue that I am seeing is that the size of the button is supposed to fall outside of the content box of the mat-simple-snackbar
.
The snackbar provides 20px
of space in a single line, but the button is supposed to be 36px
. The "best" solution I think would actually be to move the padding-like spacing from the container to the mat-simple-snackbar
. Thoughts?
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.
You should be able to work around that by using a negative margin. E.g. if you remove the size and position overrides of the ripple and focus overlay, as well as the line-height: 20px
from the button and add something like margin: -14px -24px -14px 48px
you can get the button to overlap the container padding. You might have to tweak the spacing a bit.
272786d
to
fec58ba
Compare
@crisbeto Take another look, I ended up using margins and flex to handle both the single and multi line cases. |
flex-shrink: 0; | ||
margin-left: $mat-snack-bar-button-margin; | ||
justify-content: space-around; | ||
margin: -8px 0 -8px $mat-snack-bar-button-margin; |
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.
Use the variable here?
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 can use a variable, however they are different margins so to speak.
The top and bottom margins are -8px
so that the total line height adds back up to 36px
(20 + 8 + 8). The left and right margins are for spacing within the container according to spec.
Should I create another variable? Or comment to explain it?
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.
Having another variable should be fine.
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.
Done
|
||
button { | ||
flex: 1; | ||
max-height: 36px; |
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.
Move this into a variable or add a comment about where it's coming from?
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.
Done
6385e79
to
a8555cb
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.
LGTM
89c2c0c
to
7aa229d
Compare
Investigating whether we want to add a ripple instead of bringing in all of MatButton |
d3b30c1
to
19aace8
Compare
After investigation it was determined that adding ripple manually would essentially amount to recreating |
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.
LGTM
49d8ceb
to
0d99552
Compare
731ef9b
to
c5b33b6
Compare
@josephperrott this needs to update the bazel rule now |
Caretaker note: needs a simple build file update |
c812578
to
d4e4f5b
Compare
9328f7e
to
378e5e2
Compare
2390328
to
9bf6303
Compare
9bf6303
to
da4b80a
Compare
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. |
Fixes #7505