sortableHeader.tsx 497 B

12345678910111213141516171819202122
  1. import styled from '@emotion/styled';
  2. import {IconArrow} from 'sentry/icons';
  3. export function SortableHeader({title, direction, onClick}) {
  4. const arrow = !direction ? null : (
  5. <StyledIconArrow size="xs" direction={direction === 'desc' ? 'down' : 'up'} />
  6. );
  7. return (
  8. <HeaderWrapper onClick={onClick}>
  9. {title} {arrow}
  10. </HeaderWrapper>
  11. );
  12. }
  13. const HeaderWrapper = styled('div')`
  14. cursor: pointer;
  15. `;
  16. const StyledIconArrow = styled(IconArrow)`
  17. vertical-align: top;
  18. `;