import React, { FC } from 'react'; import { useTranslation } from 'next-i18next'; import { SORT_AXIS, SORT_ORDER } from '../../interfaces/search'; const { DESC, ASC } = SORT_ORDER; type Props = { sort: SORT_AXIS, order: SORT_ORDER, onChange?: (nextSort: SORT_AXIS, nextOrder: SORT_ORDER) => void, } const SortControl: FC = (props: Props) => { const { t } = useTranslation(''); const { sort, order, onChange } = props; const onClickChangeSort = (nextSortAxis: SORT_AXIS, nextSortOrder: SORT_ORDER) => { if (onChange != null) { onChange(nextSortAxis, nextSortOrder); } }; const renderOrderIcon = () => { const iconClassName = ASC === order ? 'fa fa-sort-amount-asc' : 'fa fa-sort-amount-desc'; return