iconArrow.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React from 'react';
  2. import {css} from '@emotion/react';
  3. import theme from 'app/utils/theme';
  4. import SvgIcon from './svgIcon';
  5. type Props = React.ComponentProps<typeof SvgIcon> & {
  6. direction?: 'up' | 'right' | 'down' | 'left';
  7. };
  8. const IconArrow = React.forwardRef(function IconArrow(
  9. {direction = 'up', ...props}: Props,
  10. ref: React.Ref<SVGSVGElement>
  11. ) {
  12. return (
  13. <SvgIcon
  14. {...props}
  15. ref={ref}
  16. css={
  17. direction
  18. ? direction === 'down'
  19. ? // Down arrows have a zoom issue with Firefox inside of tables due to rotate.
  20. // Since arrows are symmetric, scaling to only flip vertically works to fix the issue.
  21. css`
  22. transform: scale(1, -1);
  23. `
  24. : css`
  25. transform: rotate(${theme.iconDirections[direction]}deg);
  26. `
  27. : undefined
  28. }
  29. >
  30. <path d="M13.76,7.32a.74.74,0,0,1-.53-.22L8,1.87,2.77,7.1A.75.75,0,1,1,1.71,6L7.47.28a.74.74,0,0,1,1.06,0L14.29,6a.75.75,0,0,1,0,1.06A.74.74,0,0,1,13.76,7.32Z" />
  31. <path d="M8,15.94a.75.75,0,0,1-.75-.75V.81a.75.75,0,0,1,1.5,0V15.19A.75.75,0,0,1,8,15.94Z" />
  32. </SvgIcon>
  33. );
  34. });
  35. IconArrow.displayName = 'IconArrow';
  36. export {IconArrow};