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

ripples and icons #275

Merged
merged 12 commits into from
Feb 3, 2016
Merged

ripples and icons #275

merged 12 commits into from
Feb 3, 2016

Conversation

peec
Copy link
Contributor

@peec peec commented Feb 3, 2016

Fixes (1.0 wip):

  • CSP for fonts include.
  • Ripples: The ripple mixin now works like intended.
  • paper-icon now works. Fix icon-fonts and upgrade fonts to v11.

@miguelcobain
Copy link
Owner

@peec I appreciate the effort.

Isn't a ripple service an overkill? A service should be used whenever there is a shared state. What shared state is there to hold in ripple effects?

@peec
Copy link
Contributor Author

peec commented Feb 3, 2016

@miguelcobain True, there is no shared state. I figured that as a service the ripple effect can be used on DOM elements separately without any need of a component and multiple times. E.g:

didInsertElement() {
    this.get('ripple').attach(this.$('.some-item-one'));
    this.get('ripple').attach(this.$('.some-item-two'));
}

So basically it's completely separated from the component, rather bound to a DOM node.

But then again, I understand that it might be overkill.

@miguelcobain
Copy link
Owner

@peec

I don't see why that wouldn't be possible without a service.
Example:

didInsertElement() {
    this.attachRipple(this.$('.some-item-one'));
    this.attachRipple(this.$('.some-item-two'));
}

attachRipple would be a method provided by including RippleMixin.

@miguelcobain
Copy link
Owner

I still like the rippleContainerSelector approach for the simple scenarios:

1 - This would attach ripple to this.$() (or this.element) - default case

export default Ember.Component.extend(RippleMixin, {
});

2 - This would attach ripple to this.$('.inner-selector')

export default Ember.Component.extend(RippleMixin, {
  rippleContainerSelector: '.inner-selector'
});

3 - This would attach ripple to this.$('.inner-selector') and this.$('.another-selector')

export default Ember.Component.extend(RippleMixin, {
  rippleContainerSelector: ['.inner-selector', '.another-selector']
});

4 - This would not attach any ripple, basically turning it into the "manual" mode. This means the component including the mixin will have to manually call attachRipple with some selector/element at some point.

export default Ember.Component.extend(RippleMixin, {
  rippleContainerSelector: null,
  didInsertElement() {
    //this is a silly example, because it would be better to use case 3.
    //imagine that some-item-one and some-item-two are dynamically generated or something
    this.attachRipple(this.$('.some-item-one'));
    this.attachRipple(this.$('.some-item-two'));
  }
});

I think these guidelines would make it a really flexible mixin!

@miguelcobain miguelcobain changed the title Wip/v1.0.0 ripples Feb 3, 2016
@peec
Copy link
Contributor Author

peec commented Feb 3, 2016

@miguelcobain Good points. Moved from service to ripple-mixin.

height: size + 'px'
};
createContainer() {
var container = Ember.$('<div class="md-ripple-container"></div>');
Copy link
Owner

Choose a reason for hiding this comment

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

We're now using let for variables and const for constants.

@miguelcobain
Copy link
Owner

@peec I'd prefer to eliminate the intermediate RippleMixins you created and have the properties on the component itself.

Otherwise we have things like importing checkbox-ripple-mixin on paper-switch.
I see it as more explicit.

You have any objections?

@peec
Copy link
Contributor Author

peec commented Feb 3, 2016

@miguelcobain Agreed. I updated and now it's just ripple-mixin along with optimizations for code structure.


return true;
},
inkRipple() {
Copy link
Owner

Choose a reason for hiding this comment

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

Since inkRipple() is basically a wrapper around rippleInk computed, we can replace all inkRipple() entries with this.get('rippleInk').

@miguelcobain
Copy link
Owner

Why did we remove those tests in paper-icon-test.js and paper-input-test.js?

@@ -28,7 +28,7 @@
{{#paper-subheader class="md-no-sticky"}}Clickable Items with Secondary Controls{{/paper-subheader}}

{{#paper-item action="transitionToWifiMenu"}}
{{paper-icon "network-wifi"}}
Copy link
Owner

Choose a reason for hiding this comment

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

Why did these happen?
Did the stylesheets change icon names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See https://github.com/google/material-design-icons/blob/master/iconfont/codepoints , this is valid names. I could not get it working with dashes.

Copy link
Owner

Choose a reason for hiding this comment

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

I see. The icon names have underscores.

I wonder why we had dashes before. Did material icons change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think something changed but not sure where, you can also try here:

@peec
Copy link
Contributor Author

peec commented Feb 3, 2016

@miguelcobain tests now passes, i think its ready.

@miguelcobain miguelcobain changed the title ripples ripples and icons Feb 3, 2016
@miguelcobain
Copy link
Owner

@peec only thing missing is to update the icon name list in the docs at ember-paper/tests/dummy/app/controllers/icons.js.

Alternatively we could just point users to the material icons page for that list. Thoughts?

@peec
Copy link
Contributor Author

peec commented Feb 3, 2016

@miguelcobain I actually updated that list, but its too large for github to see here. https://github.com/peec/ember-paper/blob/wip/v1.0.0/tests/dummy/app/controllers/icons.js

List is directly from https://github.com/google/material-design-icons/blob/master/iconfont/codepoints

Ill merge this then

peec added a commit that referenced this pull request Feb 3, 2016
@peec peec merged commit dff769f into miguelcobain:wip/v1.0.0 Feb 3, 2016
@miguelcobain
Copy link
Owner

Ah, sorry. I didn't see that.
Good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants