-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(icon-button): Add new package #2748
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2748 +/- ##
==========================================
- Coverage 98.48% 98.42% -0.07%
==========================================
Files 98 98
Lines 4232 4186 -46
Branches 538 532 -6
==========================================
- Hits 4168 4120 -48
- Misses 64 66 +2
Continue to review full report at Codecov.
|
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.
Sending partial review 'cause I have to jump into a meeting soon.
demos/card.html
Outdated
@@ -58,7 +58,7 @@ <h3 class="demo-card__subtitle mdc-typography--subtitle2">by Kurt Wagner</h3> | |||
<button class="mdc-button mdc-card__action mdc-card__action--button">Bookmark</button> | |||
</div> | |||
<div class="mdc-card__action-icons"> | |||
<i class="mdc-icon-toggle material-icons mdc-card__action mdc-card__action--icon" | |||
<i class="mdc-icon-button material-icons mdc-card__action mdc-card__action--icon" |
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.
Shouldn't we also add mdc-icon-button
to the other mdc-card__action--icon
elements to make sure it works for them? (Which would also affect MDC Card documentation, and might mean there are styles we can pull out of Card if mdc-icon-button
already covers it now)
Need to be careful to only instantiate MDCIconButtonToggle for the actual toggle buttons though, and not all icon buttons... This might actually point to a developer ergonomics problem, if it becomes difficult to programmatically distinguish things we want to be toggle-able from things that aren't.
@@ -0,0 +1,271 @@ | |||
<!DOCTYPE html> |
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 appreciate that this file was added (especially in this case where it's effectively replacing an existing component), but is it feasible to fast-follow this PR with screenshot testing page(s)?
demos/icon-button.html
Outdated
@@ -0,0 +1,271 @@ | |||
<!DOCTYPE html> | |||
<!-- | |||
Copyright 2016 Google Inc. All rights reserved. |
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.
Might want to do a copyright year check on new files
demos/icon-button.html
Outdated
<div class="toggle-example"> | ||
<h2 class="mdc-typography--headline6">Disabled Buttons</h2> | ||
<div class="demo-wrapper"> | ||
<span class="mdc-icon-button mdc-icon-button--disabled material-icons" |
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 previous comment RE potentially limiting to button
and a
elements. We shouldn't need to support a disabled
CSS modifier class at all that way, and I suspect we wouldn't need aria-disabled
then either (which is missing here but present on others below).
demos/icon-button.html
Outdated
role="button" | ||
aria-label="Transit directions" | ||
aria-pressed="false" | ||
tabindex="0"> |
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.
These shouldn't have tabindex if they're disabled.
demos/icon-button.html
Outdated
role="button" | ||
aria-label="Add to favorites" | ||
aria-pressed="false" | ||
tabindex="0"> |
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.
a
and button
elements shouldn't need tabindex
, right?
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.
a
needs tabIndex if there isn't an href
attribute.
demos/icon-button.html
Outdated
<h2 class="mdc-typography--headline6">SVG Icon</h2> | ||
<div class="demo-wrapper"> | ||
<button class="mdc-icon-button" | ||
role="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.
role="button"
is redundant for button elements, right?
demos/icon-button.html
Outdated
aria-label="Add to favorites" | ||
aria-pressed="false" | ||
tabindex="0"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24"> |
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.
Do we need width and height hard-coded inline here or should CSS cover this?
@@ -153,6 +153,7 @@ | |||
"floating-label", | |||
"form-field", | |||
"grid-list", | |||
"icon-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.
Make sure your commit message is valid when merging (your PR title has a space instead of hyphen)
packages/mdc-button/_variables.scss
Outdated
@@ -19,4 +19,7 @@ $mdc-button-horizontal-padding: 8px; | |||
$mdc-button-contained-horizontal-padding: 16px; | |||
$mdc-dense-button-height: 32px; | |||
|
|||
$mdc-button-icon-padding: 12px; |
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'm assuming these don't belong here anymore? They're never used in this PR AFAICT.
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.
If we're going to literally move the icon-toggle tests, we should add a deprecation notice to its README a la toolbar.
packages/mdc-icon-button/README.md
Outdated
|
||
<ul class="icon-list"> | ||
<li class="icon-list-item icon-list-item--spec"> | ||
<a href="https://material.io/guidelines/components/buttons.html#buttons-toggle-buttons">Material Design guidelines: Toggle buttons</a> |
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.
This is an old link. AFAIK there's no new equivalent though... we might want to notify/ask designers about that.
packages/mdc-icon-button/README.md
Outdated
<a href="https://material.io/guidelines/components/buttons.html#buttons-toggle-buttons">Material Design guidelines: Toggle buttons</a> | ||
</li> | ||
<li class="icon-list-item icon-list-item--link"> | ||
<a href="https://material-components.github.io/material-components-web-catalog/#/component/icon-toggle">Demo</a> |
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 we enter an issue in the catalog repo to add a page for this?
(It would not get merged to master and deployed until we have a new MDC Web release we can update it to; I have thoughts about release process between these packages that I need to formalize and share with the team.)
packages/mdc-icon-button/README.md
Outdated
favorite | ||
</button> | ||
``` | ||
> Note: The MDC Icon Button can be used with `<button>`, `<span>`, `<i>`, and `<a>` tags. |
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 mentioned above, we may want to restrict this to button
/ a
which make the most sense
packages/mdc-icon-button/README.md
Outdated
``` | ||
### JavaScript Instantiation | ||
|
||
The icon button will work without Javascript, but you can enhance it to hav ea ripple effect by instantiating `MDCRipple` on the root element. |
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.
have ea -> have a
packages/mdc-icon-button/README.md
Outdated
``` | ||
|
||
```js | ||
var toggleButton = new mdc.iconButton.MDCIconToggle(document.getElementById('add-to-favorites')); |
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.
Replace MDCIconToggle
with MDCIconButtonToggle
across this readme
* @param {string} dataAttr | ||
* @return {!IconToggleState} | ||
*/ | ||
parseJsonDataAttr_(dataAttr) { |
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 realize this was inherited from icon-toggle, but serious question: which do you think is better for developer ergonomics within HTML?
Current:
data-toggle-off='{"content": "favorite_border", "label": "Add to favorites"}'
This requires JSON within HTML, which in turn requires using single-quotes around the attribute value to easily have double-quotes in the value for valid JSON
Alternative:
data-toggle-off-content="favorite_border"
data-toggle-off-label="Add to favorites"
This requires writing more separate attributes (and requires us to read more separate attributes in our code) but doesn't require the use of JSON within HTML and thus the atypical use of single quotes around attribute values.
The downside is this could lead to as many as 6 total attributes (up from 2), and converting existing icon-toggles to icon-button would no longer be a single find/replace. IMO the upside is it's both more readable and writeable.
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.
Log the data attribute redesign as a follow-up issue... but we should really do that before merging this to master and publishing this package to avoid immediate breaking changes.
It should be possible for you to create a centralized branch for mdc-icon-button changes and edit this PR to target that branch.
packages/mdc-icon-button/index.js
Outdated
initRipple_() { | ||
const adapter = Object.assign(MDCRipple.createAdapter(this), { | ||
isUnbounded: () => true, | ||
isSurfaceActive: () => this.foundation_.isKeyboardActivated(), |
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.
If we think the keyboard code is safe to remove (see earlier comment), we only need to set unbounded, which we can do without needing to patch the adapter (just set ripple.unbounded = true
immediately after instantiating).
|
||
.mdc-icon-button { | ||
@include mdc-icon-button-base_; | ||
@include mdc-states(on-surface); |
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'm not sure I understand why we're setting this to on-surface here? That seems like the correct setting for card, but wouldn't be the correct setting in general? Also, we're setting up states but not ink color?
"url": "https://github.com/material-components/material-components-web.git" | ||
}, | ||
"dependencies": { | ||
"@material/animation": "^0.34.0", |
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 being used?
color: inherit; | ||
text-decoration: none; | ||
cursor: pointer; | ||
@include mdc-icon-button-base_(); |
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 there a reason for doing this rather than adding the mdc-button-icon
class directly? I'm a bit iffy on depending on "internal" mixins across packages, though maybe there's precedent for that which I'm forgetting.
If there's a convincing argument for this being done this way, maybe we should rename that mixin to be public, sort of like mdc-ripple-surface is.
@@ -92,5 +91,23 @@ | |||
// Both .mdc-top-app-bar__icon and .mdc-top-app-bar__navigation-icon share all styles except for | |||
// horizontal padding. | |||
@mixin mdc-top-app-bar-icon_() { | |||
@include mdc-icon-button-base_(); | |||
@include mdc-ripple-surface; |
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.
Did you revert this with the intent of adopting mdc-icon-button
within top app bar in a separate PR? I'm a bit confused since I do see card changes in this one.
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.
Card was previously using icon-toggle, so I went ahead and updated that one. Top app bar doesn't need to change with this PR.
Just noticed an issue in IE 11 which only affects Icon Button (not Icon Toggle): Icons are initially misaligned. When pressed, they move both vertically and horizontally. Icon Button (new): Icon Toggle (old): I tried removing the (For that matter, is there anything we can do to add specificity to our selectors for styles that conflict with |
|
||
.mdc-icon-button { | ||
@include mdc-icon-button-base_; | ||
@include mdc-states; |
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.
Does this line make sense standalone? Should we include mdc-icon-button-ink-color
with a default value 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.
I'm not following. We use mdc-states
without passing a parameter in tab, list, card and ripple.
demos/theme/theme-dark.scss
Outdated
@@ -20,6 +20,7 @@ | |||
$mdc-theme-primary: $material-color-amber-300; | |||
$mdc-theme-secondary: $material-color-pink-400; | |||
$mdc-theme-background: $material-color-grey-900; | |||
$mdc-theme-surface: $material-color-grey-900; |
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.
Does this need to be in this PR? Do other themes also need updates?
demos/theme/_menu.scss
Outdated
@@ -26,7 +26,8 @@ | |||
} | |||
|
|||
.demo-theme-list { | |||
@include mdc-theme-prop(color, text-primary-on-light); | |||
@include mdc-theme-prop(color, on-surface); |
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.
Does this need to be in this PR?
<a href="https://material.io/design/components/buttons.html#toggle-button">Material Design guidelines: Toggle buttons</a> | ||
</li> | ||
<li class="icon-list-item icon-list-item--link"> | ||
<a href="https://material-components.github.io/material-components-web-catalog/#/component/icon-toggle">Demo</a> |
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 we go ahead and update this URL now under the assumption that the next time these docs are pushed to material.io, the new page will exist?
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 think we can wait on updating the URL until after we get the catalog updated. It might not happen completely in sync, and a simple doc update change would be a fast PR.
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're referencing an appspot URL above in the article asset div; do you want to update that to match this?
packages/mdc-icon-button/README.md
Outdated
``` | ||
### JavaScript Instantiation | ||
|
||
The icon button will work without Javascript, but you can enhance it to have a ripple effect by instantiating `MDCRipple` on the root element. |
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.
Javascript -> JavaScript
demos/card.html
Outdated
tabindex="0" | ||
role="button" | ||
</button> | ||
<button class="material-icons mdc-icon-button mdc-card__action mdc-card__action--icon" |
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.
Nit: mdc-icon-button
first everywhere
|
||
/** @return {!Element} */ | ||
get iconEl_() { | ||
const {'iconInnerSelector': sel} = this.root_.dataset; |
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.
iconInnerSelector
can be removed from here and tests; it's not even properly documented for icon-toggle and we've removed mention of nested elements. Either do it here or file a follow-up issue.
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.
This is used to support font awesome. Without an inner icon element, font awesome wouldn't work correctly.
@@ -21,7 +21,7 @@ import {assert} from 'chai'; | |||
|
|||
import {supportsCssVariables} from '../../../packages/mdc-ripple/util'; | |||
import {createMockRaf} from '../helpers/raf'; | |||
import {MDCIconToggle, MDCIconToggleFoundation} from '../../../packages/mdc-icon-toggle'; | |||
import {MDCIconButtonToggle, MDCIconButtonToggleFoundation} from '../../../packages/mdc-icon-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.
Rename this file to mdc-icon-button-toggle.test.js
?
this.isHandlingKeydown_ = false; | ||
|
||
this.keydownHandler_ = /** @private {!EventListener} */ ((/** @type {!KeyboardKey} */ evt) => { | ||
if (isSpace(evt)) { |
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.
Log removal of keyboard handling as a follow-up issue if you want. I think especially considering we now have both with-JS and no-JS variants of icon button, it makes more sense for the two to operate consistently anyway.
* @param {string} dataAttr | ||
* @return {!IconToggleState} | ||
*/ | ||
parseJsonDataAttr_(dataAttr) { |
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.
Log the data attribute redesign as a follow-up issue... but we should really do that before merging this to master and publishing this package to avoid immediate breaking changes.
It should be possible for you to create a centralized branch for mdc-icon-button changes and edit this PR to target that branch.
super(Object.assign(MDCIconButtonToggleFoundation.defaultAdapter, adapter)); | ||
|
||
/** @private {boolean} */ | ||
/** @private {boolean} */ |
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.
Duplicated annotation, FYI
|
||
display: inline-block; | ||
position: relative; | ||
align-items: 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.
Remove align-items
and justify-content
since they no longer apply now that display is inline-block
} | ||
} | ||
|
||
@mixin mdc-icon-button-font-size($font-size) { |
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'm still not sure I follow why we need this rather than just adding font-size
to mdc-icon-button-size
and making it all one mixin.
demos/icon-button.html
Outdated
<div class="toggle-example"> | ||
<h2 class="mdc-typography--headline6">Using Material Icons</h2> | ||
<div class="demo-wrapper"> | ||
<a href="#" |
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'd suggest changing this to button
like the rest in this section. It doesn't make sense for a link to be a toggle, because links navigate.
@@ -35,12 +35,12 @@ | |||
<header class="mdc-toolbar mdc-toolbar--fixed demo-toolbar"> | |||
<div class="mdc-toolbar__row"> | |||
<section class="mdc-toolbar__section mdc-toolbar__section--align-start"> | |||
<button class="material-icons mdc-toolbar__menu-icon demo-drawer-toggle">menu</button> | |||
<button class="material-icons mdc-toolbar__menu-icon demo-drawer-toggle mdc-icon-button" data-mdc-ripple-is-unbounded>menu</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.
I assume the data attribute here is needed specifically for the Ripple JS... we might want to add a note in the JS instantiation section of the README about this (and that it's not needed for Icon Toggle since that handles it itself).
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.
This is used instead of .mdc-ripple-surface
for just an icon-button. This is required for the Ripple to instantiate an unbounded ripple since we're using the same function to instantiate bounded and unbounded ripples.
<a href="https://material.io/design/components/buttons.html#toggle-button">Material Design guidelines: Toggle buttons</a> | ||
</li> | ||
<li class="icon-list-item icon-list-item--link"> | ||
<a href="https://material-components.github.io/material-components-web-catalog/#/component/icon-toggle">Demo</a> |
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're referencing an appspot URL above in the article asset div; do you want to update that to match this?
packages/mdc-icon-button/README.md
Outdated
|
||
## Usage within Web Frameworks | ||
|
||
If you are using a JavaScript framework, such as React or Angular, you can create a Icon Toggle for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md). |
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.
a -> an, Icon Toggle -> Icon Button Toggle
packages/mdc-icon-button/README.md
Outdated
|
||
If you are using a JavaScript framework, such as React or Angular, you can create a Icon Toggle for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md). | ||
|
||
### `MDCIconToggleAdapter` |
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.
MDCIconButtonToggleAdapter
packages/mdc-icon-button/README.md
Outdated
`removeAttr(name: string) => void` | Removes the attribute `name` on the root element. | ||
`notifyChange(evtData: {isOn: boolean}) => void` | Broadcasts a change notification, passing along the `evtData` to the environment's event handling system. In our vanilla implementation, Custom Events are used for this. | ||
|
||
### Foundation: `MDCIconToggleFoundation` |
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.
MDCIconButtonToggleFoundation
@mixin mdc-icon-button-base_() { | ||
@include mdc-ripple-surface; | ||
@include mdc-ripple-radius-unbounded; | ||
@include mdc-icon-button-font-size(24px); |
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.
Reference variable here? Otherwise the variable is unused.
// | ||
|
||
$mdc-icon-button-size: 24px; | ||
$mdc-icon-button-padding: 12px; |
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.
This variable is unused because it's calculated in the default mixin parameter.
packages/mdc-icon-button/adapter.js
Outdated
/* eslint no-unused-vars: [2, {"args": "none"}] */ | ||
|
||
/** | ||
* Adapter for MDC Icon Toggle. Provides an interface for managing |
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.
MDC Icon Button Toggle
@@ -0,0 +1,25 @@ | |||
{ | |||
"name": "@material/icon-button", | |||
"description": "The Material Components for the icon button component", |
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.
missing "web" after "the"?
setDisabled(isDisabled) { | ||
this.disabled_ = isDisabled; | ||
|
||
const {ARIA_DISABLED} = MDCIconButtonToggleFoundation.strings; |
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.
We don't need to maintain aria-disabled anymore since we're stating that disabled state applies only to buttons directly, right? (Also affects tests, and probably renders this constant unused)
Can we add a deprecation notice to mdc-icon-toggle's readme in here? Perhaps we should also remove demo links from it in preparation for the demo being moved in catalog? |
demos/icon-button.scss
Outdated
|
||
.demo-icon-button-large { | ||
@include mdc-icon-button-font-size(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.
Missing newline at end of file
demos/icon-button.scss
Outdated
@include mdc-states-base-color(#de442c); | ||
@include mdc-states-hover-opacity(.09); | ||
@include mdc-states-focus-opacity(.26); | ||
@include mdc-states-press-opacity(.35); | ||
} | ||
|
||
.demo-icon-button-large { | ||
@include mdc-icon-button-font-size(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.
mdc-icon-button-size
import {MDCRipple} from '../../../packages/mdc-ripple'; | ||
import {cssClasses} from '../../../packages/mdc-ripple/constants'; | ||
|
||
function setupTest({tabIndex = undefined, useInnerIconElement = false} = {}) { | ||
const root = document.createElement(useInnerIconElement ? 'span' : 'i'); | ||
const root = document.createElement(useInnerIconElement ? 'span' : '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.
Shouldn't the outer element always be the button? I thought font-awesome required the inner icon element to be i
.
demos/theme/index.html
Outdated
data-toggle-on-label="Remove from favorites" | ||
data-toggle-off-content="favorite_border" | ||
data-toggle-off-label="Add to favorites"> | ||
favorite_borde |
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.
Typo: the last r
got deleted
aria-label="Add to favorites" tabindex="0" | ||
data-toggle-on='{"label": "Remove from favorites", "content": "favorite"}' | ||
data-toggle-off='{"label": "Add to favorites", "content": "favorite_border"}' | ||
<button class="mdc-icon-toggle material-icons" |
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.
This still says mdc-icon-toggle; I think it should say mdc-icon-button?
Also, remove trailing space after favorite_border
packages/mdc-icon-button/README.md
Outdated
|
||
<!--<div class="article__asset"> | ||
<a class="article__asset-link" | ||
href="https://material.io/design/components/buttons.html#toggle-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.
This is supposed to link to a demo, not a design article.
packages/mdc-icon-button/README.md
Outdated
--- | --- | ||
`data-toggle-<TOGGLE STATE>-label` | The value to apply to the element's "aria-label" attribute. | ||
`data-toggle-<TOGGLE STATE>-content` | The text content to set on the element. Note that if an inner icon is used, the text content will be set on that element instead. | ||
`data-toggle-<TOGGLE STATE>-class` | A css class to apply to the icon element. The same rules regarding inner icon elements described for `content` apply here as well. |
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.
Nit: capitalize CSS
packages/mdc-icon-button/README.md
Outdated
### Icons | ||
|
||
The icon button can be used with a standard icon library or an `svg`. The icon button toggle should only be used with | ||
an standard icon library. We recommend you use [Material Icons](https://material.io/icons/) from Google Fonts. |
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.
Update link to material.io/tools/icons to skip redirect
packages/mdc-icon-button/README.md
Outdated
Property | Value Type | Description | ||
--- | --- | --- | ||
`on` | Boolean | Sets the toggle state to the provided `isOn` value. | ||
`disabled` | Boolean | Sets the icon toggle to the `disabled` state. |
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.
AFAICT this no longer exists in the component and tests.
```js | ||
import {MDCRipple} from '@material/ripple'; | ||
|
||
const iconButtonRipple = new MDCRipple(document.querySelector('.mdc-icon-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.
Should we include another line here for iconButtonRipple.unbounded = true
in order to get the ripple to look correct?
fixes: #2673