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

fix(snackbar): Drop mdc-button from snackbar's dependency #1292

Merged
merged 2 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions demos/snackbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
aria-hidden="true">
<div class="mdc-snackbar__text">Message sent</div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button">Undo</button>
<button type="button" class="mdc-snackbar__action-button">Undo</button>
</div>
</div>
</section>
Expand Down Expand Up @@ -130,7 +130,7 @@ <h2 class="mdc-typography--title">Basic Example</h2>
</div>
<br/>

<button type="button" class="mdc-button mdc-button--raised mdc-button--primary" id="toggle-dark-theme">Toggle Dark Theme</button>
<button type="button" class="mdc-button mdc-button--raised" id="toggle-dark-theme">Toggle Dark Theme</button>
<br/>

<div class="mdc-textfield">
Expand All @@ -157,7 +157,7 @@ <h2 class="mdc-typography--title">Basic Example</h2>
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
<div dir="rtl">
Expand All @@ -168,7 +168,7 @@ <h2 class="mdc-typography--title">Basic Example</h2>
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
</div>
Expand All @@ -179,7 +179,7 @@ <h2 class="mdc-typography--title">Basic Example</h2>
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
<div dir="rtl">
Expand All @@ -190,7 +190,7 @@ <h2 class="mdc-typography--title">Basic Example</h2>
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/mdc-snackbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ npm install --save @material/snackbar
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
```
Expand All @@ -65,7 +65,7 @@ snackbar, add the `mdc-snackbar--align-start` modifier class to the root element
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
```
Expand Down Expand Up @@ -153,7 +153,7 @@ To respond to a snackbar action, assign a function to the optional `actionHandle
aria-hidden="true">
<div class="mdc-snackbar__text"></div>
<div class="mdc-snackbar__action-wrapper">
<button type="button" class="mdc-button mdc-snackbar__action-button"></button>
<button type="button" class="mdc-snackbar__action-button"></button>
</div>
</div>
```
Expand Down
15 changes: 11 additions & 4 deletions packages/mdc-snackbar/mdc-snackbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,27 @@
/* stylelint-enable plugin/selector-bem-pattern */

&__action-button {
@include mdc-typography(button);
@include mdc-theme-prop(color, secondary);

@include mdc-theme-dark(".mdc-snackbar") {
@include mdc-theme-prop(color, primary);
}

@include mdc-rtl-reflexive-box(margin, right, -16px, ".mdc-snackbar");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this line removed? This effectively shifts the action button to the left 16px.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line used to be the mechanism to reverse padding introduce by button, since now there is no longer padding: 0 16px, we also could safely remove the margin-direction: -16px here.

Could you take a look at the deployed dev server and see if this style looks correct to you?


min-width: auto;
height: inherit;
transition: mdc-animation-exit-permanent(opacity, .3s);
padding: 0;
border: none;
outline: none;
background-color: transparent;
opacity: 0;
user-select: none;
-webkit-appearance: none;
visibility: hidden;

&:hover {
cursor: pointer;
}

&::-moz-focus-inner {
border: 0;
}
Expand Down
1 change: 0 additions & 1 deletion packages/mdc-snackbar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"dependencies": {
"@material/animation": "^0.3.1",
"@material/base": "^0.2.5",
"@material/button": "^0.6.0",
"@material/rtl": "^0.1.7",
"@material/theme": "^0.3.0",
"@material/typography": "^0.3.0"
Expand Down