mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-23 22:45:06 -04:00
New: Project Aphrodite
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { icons, sortDirections } from 'Helpers/Props';
|
||||
import SelectedMenuItem from './SelectedMenuItem';
|
||||
|
||||
function SortMenuItem(props) {
|
||||
const {
|
||||
name,
|
||||
sortKey,
|
||||
sortDirection,
|
||||
...otherProps
|
||||
} = props;
|
||||
|
||||
const isSelected = name === sortKey;
|
||||
|
||||
return (
|
||||
<SelectedMenuItem
|
||||
name={name}
|
||||
selectedIconName={sortDirection === sortDirections.ASCENDING ? icons.SORT_ASCENDING : icons.SORT_DESCENDING}
|
||||
isSelected={isSelected}
|
||||
{...otherProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
SortMenuItem.propTypes = {
|
||||
name: PropTypes.string,
|
||||
sortKey: PropTypes.string,
|
||||
sortDirection: PropTypes.oneOf(sortDirections.all),
|
||||
onPress: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
SortMenuItem.defaultProps = {
|
||||
name: null
|
||||
};
|
||||
|
||||
export default SortMenuItem;
|
||||
Reference in New Issue
Block a user