iconChevron.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import * as 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. isCircled?: boolean;
  8. };
  9. const IconChevron = React.forwardRef(function IconChevron(
  10. {isCircled = false, direction = 'up', ...props}: Props,
  11. ref: React.Ref<SVGSVGElement>
  12. ) {
  13. return (
  14. <SvgIcon
  15. {...props}
  16. ref={ref}
  17. css={
  18. direction
  19. ? css`
  20. transition: transform 120ms ease-in-out;
  21. transform: rotate(${theme.iconDirections[direction]}deg);
  22. `
  23. : undefined
  24. }
  25. >
  26. {isCircled ? (
  27. <React.Fragment>
  28. <path d="M8,16a8,8,0,1,1,8-8A8,8,0,0,1,8,16ZM8,1.53A6.47,6.47,0,1,0,14.47,8,6.47,6.47,0,0,0,8,1.53Z" />
  29. <path d="M11.12,9.87a.73.73,0,0,1-.53-.22L8,7.07,5.41,9.65a.74.74,0,0,1-1.06,0,.75.75,0,0,1,0-1.06L7.47,5.48a.74.74,0,0,1,1.06,0l3.12,3.11a.75.75,0,0,1,0,1.06A.74.74,0,0,1,11.12,9.87Z" />
  30. </React.Fragment>
  31. ) : (
  32. <path d="M14,11.75a.74.74,0,0,1-.53-.22L8,6.06,2.53,11.53a.75.75,0,0,1-1.06-1.06l6-6a.75.75,0,0,1,1.06,0l6,6a.75.75,0,0,1,0,1.06A.74.74,0,0,1,14,11.75Z" />
  33. )}
  34. </SvgIcon>
  35. );
  36. });
  37. IconChevron.displayName = 'IconChevron';
  38. export {IconChevron};