iconArrow.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {forwardRef} from 'react';
  2. import {css} from '@emotion/react';
  3. import theme from 'sentry/utils/theme';
  4. import {SvgIcon, SVGIconProps} from './svgIcon';
  5. interface Props extends SVGIconProps {
  6. direction?: 'up' | 'right' | 'down' | 'left';
  7. }
  8. const IconArrow = forwardRef<SVGSVGElement, Props>(
  9. ({direction = 'up', ...props}, ref) => {
  10. return (
  11. <SvgIcon
  12. {...props}
  13. ref={ref}
  14. css={
  15. direction
  16. ? direction === 'down'
  17. ? // Down arrows have a zoom issue with Firefox inside of tables due to rotate.
  18. // Since arrows are symmetric, scaling to only flip vertically works to fix the issue.
  19. css`
  20. transform: scale(1, -1);
  21. `
  22. : css`
  23. transform: rotate(${theme.iconDirections[direction]}deg);
  24. `
  25. : undefined
  26. }
  27. >
  28. <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" />
  29. <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" />
  30. </SvgIcon>
  31. );
  32. }
  33. );
  34. IconArrow.displayName = 'IconArrow';
  35. export {IconArrow};