Skip to content

Commit

Permalink
move default styles to TextField
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Henley committed Apr 24, 2016
1 parent b800fe1 commit f8a4a63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
10 changes: 10 additions & 0 deletions src/TextField/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ const getStyles = (props, context, state) => {
transition: transitions.easeOut(),
},
floatingLabel: {
position: 'absolute',
lineHeight: '22px',
top: 38,
transition: transitions.easeOut(),
zIndex: 1, // Needed to display label above Chrome's autocomplete field background
cursor: props.disabled ? 'default' : 'text',
transform: 'scale(1) translate3d(0, 0, 0)',
transformOrigin: 'left top',
pointerEvents: 'auto',
userSelect: 'none',
color: hintColor,
},
input: {
Expand Down
16 changes: 1 addition & 15 deletions src/TextField/TextFieldLabel.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import React, {PropTypes} from 'react';
import transitions from '../styles/transitions';

function getStyles(props) {
const defaultStyles = {
position: 'absolute',
lineHeight: '22px',
top: 38,
transition: transitions.easeOut(),
zIndex: 1, // Needed to display label above Chrome's autocomplete field background
cursor: props.disabled ? 'default' : 'text',
transform: 'scale(1) translate3d(0, 0, 0)',
transformOrigin: 'left top',
pointerEvents: 'auto',
userSelect: 'none',
};

const shrinkStyles = props.shrink ? Object.assign({
transform: 'perspective(1px) scale(0.75) translate3d(0, -28px, 0)',
pointerEvents: 'none',
}, props.shrinkStyle) : null;

return {
root: Object.assign(defaultStyles, props.style, shrinkStyles),
root: Object.assign(props.style, shrinkStyles),
};
}

Expand Down

0 comments on commit f8a4a63

Please sign in to comment.