Skip to content

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

Merged
merged 1 commit into from
Mar 29, 2018

Conversation

josephperrott
Copy link
Member

Fixes #7505

@josephperrott josephperrott requested a review from crisbeto October 3, 2017 20:21
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 3, 2017
@@ -16,6 +16,14 @@ $mat-snack-bar-button-margin: 48px !default;
background: none;
Copy link
Member

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;
Copy link
Member

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?

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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.

@josephperrott
Copy link
Member Author

@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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the variable here?

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@josephperrott josephperrott force-pushed the snackbar-button branch 2 times, most recently from 6385e79 to a8555cb Compare October 6, 2017 20:49
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Oct 6, 2017
@josephperrott josephperrott force-pushed the snackbar-button branch 2 times, most recently from 89c2c0c to 7aa229d Compare October 6, 2017 22:05
@jelbourn jelbourn removed the action: merge The PR is ready for merge by the caretaker label Oct 26, 2017
@jelbourn
Copy link
Member

Investigating whether we want to add a ripple instead of bringing in all of MatButton

@josephperrott josephperrott force-pushed the snackbar-button branch 2 times, most recently from d3b30c1 to 19aace8 Compare October 26, 2017 17:41
@josephperrott
Copy link
Member Author

After investigation it was determined that adding ripple manually would essentially amount to recreating MatButton within snack bar.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Oct 26, 2017
@josephperrott josephperrott changed the title fix(snack-bar): use mat-button in simple snack bar fix(snack-bar): use mat-button like styling in simple snack bar Nov 2, 2017
@josephperrott josephperrott force-pushed the snackbar-button branch 3 times, most recently from 49d8ceb to 0d99552 Compare November 20, 2017 16:13
@josephperrott josephperrott force-pushed the snackbar-button branch 3 times, most recently from 731ef9b to c5b33b6 Compare December 6, 2017 21:06
@josephperrott josephperrott added the target: minor This PR is targeted for the next minor release label Dec 6, 2017
@andrewseguin andrewseguin added the presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged label Dec 13, 2017
@jelbourn
Copy link
Member

jelbourn commented Jan 3, 2018

@josephperrott this needs to update the bazel rule now

@jelbourn jelbourn added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: merge The PR is ready for merge by the caretaker presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged labels Jan 3, 2018
@jelbourn
Copy link
Member

jelbourn commented Jan 3, 2018

Caretaker note: needs a simple build file update

@josephperrott josephperrott force-pushed the snackbar-button branch 2 times, most recently from c812578 to d4e4f5b Compare January 8, 2018 18:19
@josephperrott josephperrott added the action: merge The PR is ready for merge by the caretaker label Jan 8, 2018
@josephperrott josephperrott force-pushed the snackbar-button branch 2 times, most recently from 9328f7e to 378e5e2 Compare March 7, 2018 21:25
@josephperrott josephperrott added the P2 The issue is important to a large percentage of users, with a workaround label Mar 8, 2018
@josephperrott josephperrott force-pushed the snackbar-button branch 3 times, most recently from 2390328 to 9bf6303 Compare March 28, 2018 16:44
@josephperrott josephperrott merged commit b47bfaf into angular:master Mar 29, 2018
@josephperrott josephperrott deleted the snackbar-button branch March 29, 2018 21:53
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request(Snackbar): Give user feedback when pressing/clicking the action button
5 participants