Find label based on value

This commit is contained in:
Belen Curcio
2017-10-12 13:40:43 -03:00
parent 27ef2ad0d4
commit 351ebc9105
2 changed files with 5 additions and 7 deletions
@@ -34,7 +34,6 @@ const Table = ({headers, commenters, onHeaderClickHandler, onRoleChange, onComme
<td className="mdl-data-table__cell--non-numeric">
<Dropdown
value={row.status}
label={capitalize(row.status)}
placeholder={t('community.status')}
onChange={(status) => onCommenterStatusChange(row.id, status)}>
<Option value={'ACTIVE'} label={t('community.active')} />
@@ -43,8 +42,7 @@ const Table = ({headers, commenters, onHeaderClickHandler, onRoleChange, onComme
</td>
<td className="mdl-data-table__cell--non-numeric">
<Dropdown
value={row.roles[0] || t('community.none')}
label={capitalize(row.roles[0]) || t('community.none')}
value={row.roles[0] || ''}
placeholder={t('community.role')}
onChange={(role) => onRoleChange(row.id, role)}>
<Option value={''} label={t('community.none')} />
+4 -4
View File
@@ -69,10 +69,10 @@ class Dropdown extends React.Component {
const options = React.Children.toArray(this.props.children);
const option = options.find((option) => option.props.value === this.props.value);
if (option.label) {
return option.label;
} else if(option.value) {
return option.value;
if (option.props.label) {
return option.props.label;
} else if(option.props.value) {
return option.props.value;
} else {
return this.props.placeholder;
}