BerkeleyTrue / react-material

Material design components written with React.js and React Style
http://berkeleytrue.github.io/react-material
404 stars 38 forks source link

Text field component enhancements #64

Closed robertknight closed 9 years ago

robertknight commented 9 years ago

This brings the implementation of the text field component closer to the Polymer Paper elements version:

I have a few general questions/thoughts:

robertknight commented 9 years ago

The animations are working on mobile but the Polymer ones are smoother. Couple of things I notice from their code: 1) They are animating via translate3d() and scale3d() transforms rather than animating the font size and width. 2) They cache the transform for a field just before applying it for the first time. I don't know how important that is.

SanderSpies commented 9 years ago

Wow, animating from the mousedown position makes a ton of difference for this animation (certain others do this always from the center position). Looks nice!

  1. I don't think we should use em, for now it's rather unclear where all the elements end up - and that could have unpredictable consequences. I would prefer to use rem with a fallback to px (IE8, although not TOO important). Also using constants could help with making it simpler.
  2. passing events should be good enough in general, might need some changes in some cases where it makes sense. There should be an "escape-hatch" to access the DOM input element directly.
  3. there is the idea to create a mixin within React Style which allows to do styles={{this.props.styles, somethingElse.styles]} which would solve the theming issues. Could be something for after the upcoming 0.4 release of React Style.
  4. preferably Closure Compiler Linter Strict mode - but our current coverage is rather bad :-( The idea is to have react-material eventually building using Closure Compiler Advanced Mode.
  5. mobile is definitely priority number 1 - so if we could improve there, that would be great.

PR looks like a good improvement, further improvements can be build upon this code.

SanderSpies commented 9 years ago

FYI. the upcoming react-style 0.4 will drop support for pseudo-classes, which is explained here: https://github.com/js-next/react-style/blob/0.4/CHANGES.md.