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

Allow deselection of optional SelectField #120

Merged
merged 8 commits into from
Oct 28, 2016
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const renderSelect = props =>
ref={props.inputRef}
value={props.value}
>
{!!props.placeholder && (
<option value="" disabled hidden>
{props.placeholder}
{(!!props.placeholder || !props.required) && (
<option value="" disabled={props.required} hidden={props.required}>
{props.placeholder ? props.placeholder : props.label}
</option>
)}

Expand All @@ -64,4 +64,3 @@ const Select = props =>
;

export default connectField(Select);

Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const renderSelect = props =>
ref={props.inputRef}
value={props.value}
>
{!!props.placeholder && (
<option value="" disabled hidden>
{props.placeholder}
{(!!props.placeholder || !props.required) && (
<option value="" disabled={props.required} hidden={props.required}>
{props.placeholder ? props.placeholder : props.label}
</option>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const renderCheckboxes = ({allowedValues, disabled, fieldType, id, name, onChang
)
;

const renderSelect = ({allowedValues, disabled, id, inputRef, name, onChange, placeholder, transform, value}) =>
const renderSelect = ({allowedValues, disabled, id, inputRef, label, name, onChange, placeholder, required, transform, value}) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is not passing ESLint.

<select
disabled={disabled}
id={id}
Expand All @@ -42,9 +42,9 @@ const renderSelect = ({allowedValues, disabled, id, inputRef, name, onChange, pl
ref={inputRef}
value={value}
>
{!!placeholder && (
<option value="" disabled hidden>
{placeholder}
{(!!placeholder || !required) && (
<option value="" disabled={required} hidden={required}>
{placeholder ? placeholder : label}
</option>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const renderCheckboxes = ({allowedValues, disabled, fieldType, id, name, onChang
)
;

const renderSelect = ({allowedValues, disabled, id, inputRef, name, onChange, placeholder, transform, value}) =>
const renderSelect = ({allowedValues, disabled, id, inputRef, label, name, onChange, placeholder, required, transform, value}) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

This one too.

<select
disabled={disabled}
id={id}
Expand All @@ -39,9 +39,9 @@ const renderSelect = ({allowedValues, disabled, id, inputRef, name, onChange, pl
ref={inputRef}
value={value}
>
{!!placeholder && (
<option value="" disabled hidden>
{placeholder}
{(!!placeholder || !required) && (
<option value="" disabled={required} hidden={required}>
{placeholder ? placeholder : label}
</option>
)}

Expand Down