Show sort direction in SortDropdown

This commit is contained in:
John Furrow
2017-02-04 18:28:12 -08:00
parent eabc08c6c1
commit f11594f9f0
5 changed files with 37 additions and 6 deletions
@@ -39,12 +39,21 @@ class SortDropdown extends React.Component {
}
getDropdownMenus() {
const {direction, selectedProperty} = this.props;
let items = SORT_PROPERTIES.map((sortProp) => {
const isSelected = sortProp === this.props.selectedProperty;
const directionIndicator = isSelected ? (
<span className={`sort-dropdown__indicator sort-dropdown__indicator--${direction}`} />
) : null;
return {
displayName: this.props.intl.formatMessage(
TorrentProperties[sortProp]
displayName: (
<div className="sort-dropdown__item">
{this.props.intl.formatMessage(TorrentProperties[sortProp])}
{directionIndicator}
</div>
),
selected: this.props.selectedProperty === sortProp,
selected: isSelected,
property: sortProp
};
});