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

[TextField] Added hintStyle property #1510

Merged
merged 2 commits into from
Sep 29, 2015
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
10 changes: 10 additions & 0 deletions docs/src/app/components/pages/components/text-fields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ let TextFieldsPage = React.createClass({
header: 'optional',
desc: 'If true, the field receives the property width 100%.'
},
{
name: 'hintStyle',
type: 'object',
header: 'optional',
desc: 'Override the inline-styles of the TextField\'s hint text element.'
},
{
name: 'hintText',
type: 'string',
Expand Down Expand Up @@ -210,6 +216,10 @@ let TextFieldsPage = React.createClass({
<TextField
style={styles.textfield}
hintText="Hint Text" /><br/>
<TextField
style={styles.textField}
hintText="Styled Hint Text"
hintStyle={{color: 'red'}} /><br/>
<TextField
style={styles.textfield}
hintText="Hint Text"
Expand Down
4 changes: 4 additions & 0 deletions docs/src/app/components/raw-code/text-fields-code.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//In Line Hint Text
<TextField
hintText="Hint Text" />
<TextField
style={styles.textField}
hintText="Styled Hint Text"
hintStyle={{color: 'red'}} />
<TextField
hintText="Hint Text"
defaultValue="Default Value" />
Expand Down
4 changes: 3 additions & 1 deletion src/text-field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let TextField = React.createClass({
React.PropTypes.string,
React.PropTypes.element,
]),
hintStyle: React.PropTypes.object,
id: React.PropTypes.string,
inputStyle: React.PropTypes.object,
multiLine: React.PropTypes.bool,
Expand Down Expand Up @@ -240,6 +241,7 @@ let TextField = React.createClass({
floatingLabelText,
fullWidth,
hintText,
hintStyle,
id,
multiLine,
onBlur,
Expand All @@ -259,7 +261,7 @@ let TextField = React.createClass({
) : null;

let hintTextElement = hintText ? (
<div style={this.mergeAndPrefix(styles.hint)}>{hintText}</div>
<div style={this.mergeAndPrefix(styles.hint, this.props.hintStyle)}>{hintText}</div>
Copy link
Member

Choose a reason for hiding this comment

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

hintStyle instead of this.props.hintStyle

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps trivial but good catch @oliviertassinari

@bgribben quick fix please? :)

) : null;

let floatingLabelTextElement = floatingLabelText ? (
Expand Down