-
Notifications
You must be signed in to change notification settings - Fork 2.9k
TextField: Convert to flexbox, support addons #1574
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
Merged
micahgodbolt
merged 18 commits into
microsoft:master
from
micahgodbolt:textfield-flexbox
Apr 26, 2017
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6996631
Init textfield flexbox updates
micahgodbolt a4b72ec
Add changefile
micahgodbolt cfd6032
Merge branch 'master' into textfield-flexbox
micahgodbolt bb5d6ad
Reduced text padding to 1px
micahgodbolt 74639cc
Updated docs and fixed linting errors
micahgodbolt 5ad3edd
Merge branch 'textfield-flexbox' of https://github.com/micahgodbolt/o…
micahgodbolt a974d00
Merge branch 'master' into textfield-flexbox
micahgodbolt d42e380
Fixed caps of Utilities
micahgodbolt 99803e6
Merge branch 'master' into textfield-flexbox
micahgodbolt 36106bd
Merge branch 'master' into textfield-flexbox
micahgodbolt 54bb2fa
Fixed icons in multi line
micahgodbolt c0a6e85
Merge branch 'master' into textfield-flexbox
micahgodbolt c74fbc3
Update TextField.Basic.Example.tsx
micahgodbolt 27233b2
Added type to onRender method and fixed hex colors
micahgodbolt 3ec5032
Merge branch 'master' into textfield-flexbox
micahgodbolt a8f060d
Removed icon exampe in textfield
micahgodbolt 62bb312
Merge branch 'textfield-flexbox' of https://github.com/micahgodbolt/o…
micahgodbolt a619df0
Merge branch 'master' into textfield-flexbox
micahgodbolt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "TextField: Convert to flexbox, support addons", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "email": "micahgodbolt@gmail.com" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import * as React from 'react'; | ||
| import { ITextField, ITextFieldProps } from './TextField.Props'; | ||
| import { Label } from '../../Label'; | ||
| import { Icon } from '../../Icon'; | ||
| import { | ||
| DelayedRender, | ||
| BaseComponent, | ||
|
|
@@ -127,7 +128,9 @@ export class TextField extends BaseComponent<ITextFieldProps, ITextFieldState> i | |
| label, | ||
| multiline, | ||
| required, | ||
| underlined | ||
| underlined, | ||
| addonString, | ||
| onRenderAddon = this._onRenderAddon | ||
| } = this.props; | ||
| let { isFocused } = this.state; | ||
| const errorMessage: string = this._errorMessage; | ||
|
|
@@ -144,8 +147,15 @@ export class TextField extends BaseComponent<ITextFieldProps, ITextFieldState> i | |
| return ( | ||
| <div className={ textFieldClassName }> | ||
| { label && <Label htmlFor={ this._id }>{ label }</Label> } | ||
| { iconClass && <i className={ css(iconClass, styles.icon) }></i> } | ||
| { multiline ? this._renderTextArea() : this._renderInput() } | ||
| <div className={ css(styles.fieldGroup) }> | ||
| { (addonString !== undefined || this.props.onRenderAddon) && ( | ||
| <div className={ css(styles.fieldAddon) }> | ||
| { onRenderAddon(this.props, this._onRenderAddon) } | ||
| </div> | ||
| ) } | ||
| { multiline ? this._renderTextArea() : this._renderInput() } | ||
| { iconClass && <i className={ css(iconClass, styles.icon) }></i> } | ||
| </div> | ||
| { this._isDescriptionAvailable && | ||
| <span id={ this._descriptionId }> | ||
| { description && <span className={ css('ms-TextField-description', styles.description) }>{ description }</span> } | ||
|
|
@@ -225,6 +235,13 @@ export class TextField extends BaseComponent<ITextFieldProps, ITextFieldState> i | |
| } | ||
| } | ||
|
|
||
| private _onRenderAddon(props): JSX.Element { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. type? |
||
| let { addonString } = props; | ||
| return ( | ||
| <span style={ { paddingBottom: '1px' } }>{ addonString }</span> | ||
| ); | ||
| } | ||
|
|
||
| private _getTextElementClassName(): string { | ||
| const errorMessage: string = this._errorMessage; | ||
| let textFieldClassName: string; | ||
|
|
||
13 changes: 11 additions & 2 deletions
13
...ages/office-ui-fabric-react/src/components/TextField/examples/TextField.Basic.Example.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
no theme colors?
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.
Hah...thanks for catching that. Grabbed hex values from the designer, forgot to convert them.