Skip to content

fix(Input): fix size prop (#660)#662

Merged
TheSharpieOne merged 3 commits intoreactstrap:masterfrom
gergely-nagy:master
Oct 30, 2017
Merged

fix(Input): fix size prop (#660)#662
TheSharpieOne merged 3 commits intoreactstrap:masterfrom
gergely-nagy:master

Conversation

@gergely-nagy
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Member

@TheSharpieOne TheSharpieOne left a comment

Choose a reason for hiding this comment

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

Looks good, just a few minor things to better line up with reactstrap and not restricting to basic bootstrap implementation only.

Comment thread src/Input.js Outdated
children: PropTypes.node,
type: PropTypes.string,
size: PropTypes.string,
bsSize: PropTypes.oneOf(['lg', 'sm']),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't limit this. If someone wants to extend bootstrap to add something like xl (or anything else) they should be able to just add their class and pass it here.

Comment thread src/Input.js
@@ -72,11 +73,16 @@ class Input extends React.Component {
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd do a regex check to see if it is a word/not a number to trigger this logic. It works with the custom sizes better.

Comment thread src/Input.js Outdated
}
}

if (['lg', 'sm'].indexOf(attributes.size) > -1) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should also delete size from attributes so it doesn't get passed down to the DOM in this case.

Comment thread src/Input.js Outdated
} = this.props;

const checkInput = ['radio', 'checkbox'].indexOf(type) > -1;
const isNotaNumber = new RegExp('(?!^\\d+$)^.+$');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/\D/g would work and is more clear. new RegExp('\\D','g') if you want to use new RegExp

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes , this is much better. Sorry, i forgot this global flag . Thank you for taking your time for the review. I'll fix it right away.

@TheSharpieOne TheSharpieOne merged commit cc2bd13 into reactstrap:master Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants