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

feat(component): add filterable prop to Select #227

Merged
merged 1 commit into from
Oct 29, 2019

Conversation

jorgemoya
Copy link
Contributor

@jorgemoya jorgemoya commented Oct 29, 2019

Functionality will remain the same by default, but now it can be set to false to prevent input filtering.

Misc:
Added back the label styling rule, it was actually needed.

@jorgemoya jorgemoya requested a review from a team October 29, 2019 17:58
Comment on lines +47 to +49
label {
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed, so I added it back.

@@ -120,7 +131,7 @@ export class Select<T extends any> extends React.PureComponent<SelectProps<T>, S
}

private renderInput() {
const { placeholder, error, required, disabled, onChange, options, value } = this.props;
const { placeholder, error, filterable = true, required, disabled, onChange, options, value } = this.props;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the best way to set a default? Not sure when to use defaultProps or just default like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be fine. In this case since the prop is at the class level, it might be better to add it onto defaultProps. That way undefined doesn't get passed through the component.

Copy link
Contributor

@chanceaclark chanceaclark left a comment

Choose a reason for hiding this comment

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

🍹 If you want to change the default props you can, but otherwise lgtm.

@jorgemoya jorgemoya merged commit f05d343 into bigcommerce:master Oct 29, 2019
@jorgemoya jorgemoya deleted the filterable-select branch October 29, 2019 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants