Skip to content

Commit

Permalink
Merge pull request #6 from zberkom/add-variant-prop-support
Browse files Browse the repository at this point in the history
Add TextField variant prop support
  • Loading branch information
alexplumb committed Mar 12, 2019
2 parents 07d7cee + 55d244f commit fbf8ce9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ function handleOnChange(value) {
<td> boolean </td>
<td colspan="2"> TextField error state </td>
</tr>

<tr>
<td> variant </td>
<td> string </td>
<td colspan="2"> 'standard' by default </td>
</tr>
</table>

### Regions
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions src/components/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class MaterialUiPhoneNumber extends React.Component {
autoFocus: PropTypes.bool,
helperText: PropTypes.string,
error: PropTypes.bool,
variant: PropTypes.bool,

inputClass: PropTypes.string,
dropdownClass: PropTypes.string,
Expand Down Expand Up @@ -92,6 +93,7 @@ class MaterialUiPhoneNumber extends React.Component {
label: null,
helperText: null,
error: false,
variant: 'standard',

inputClass: '',
dropdownClass: '',
Expand All @@ -108,7 +110,7 @@ class MaterialUiPhoneNumber extends React.Component {

localization: {},

onEnterKeyPress: () => {},
onEnterKeyPress: () => { },

isModernBrowser: () => (document.createElement ? Boolean(document.createElement('input').setSelectionRange) : false),

Expand Down Expand Up @@ -330,9 +332,9 @@ class MaterialUiPhoneNumber extends React.Component {
remainingText: tail(acc.remainingText),
};
}, {
formattedText: '',
remainingText: text.split(''),
});
formattedText: '',
remainingText: text.split(''),
});

let formattedNumber;
if (enableLongNumbers) {
Expand Down Expand Up @@ -697,6 +699,7 @@ class MaterialUiPhoneNumber extends React.Component {
const {
classes, inputClass, helperText, required, disabled, autoFocus, error,
name, label, dropdownClass, localization, disableDropdown, inputProps,
variant
} = this.props;

const inputFlagClasses = `flag ${selectedCountry.iso2}`;
Expand Down Expand Up @@ -767,6 +770,7 @@ class MaterialUiPhoneNumber extends React.Component {

return (
<TextField
variant={variant}
placeholder={placeholder}
value={formattedNumber}
className={inputClass}
Expand Down

0 comments on commit fbf8ce9

Please sign in to comment.