iconArrow.tsx 1.3 KB

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