import React, { memo } from 'react'
import SortIndicatorArrow from './SortIndicatorArrow'
import { type TableTheme } from './theme'

type Props = {
  direction: 'asc' | 'desc' | null
  theme: TableTheme
}

const SortIndicator = ({ direction, theme }: Props): JSX.Element | null => {
  if (!direction) {
    return null
  }

  return <SortIndicatorArrow direction={direction} theme={theme} />
}

export default memo(SortIndicator)
