iconChevron.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {forwardRef, Fragment} from 'react';
  2. import {css, useTheme} from '@emotion/react';
  3. import type {SVGIconProps} from './svgIcon';
  4. import {SvgIcon} from './svgIcon';
  5. interface Props extends SVGIconProps {
  6. direction?: 'up' | 'right' | 'down' | 'left';
  7. isCircled?: boolean;
  8. }
  9. const IconChevron = forwardRef<SVGSVGElement, Props>(
  10. ({isCircled = false, direction = 'up', ...props}, ref) => {
  11. const theme = useTheme();
  12. return (
  13. <SvgIcon
  14. {...props}
  15. ref={ref}
  16. css={
  17. direction
  18. ? css`
  19. transition: transform 120ms ease-in-out;
  20. transform: rotate(${theme.iconDirections[direction]}deg);
  21. `
  22. : undefined
  23. }
  24. >
  25. {isCircled ? (
  26. <Fragment>
  27. <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" />
  28. <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" />
  29. </Fragment>
  30. ) : (
  31. <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" />
  32. )}
  33. </SvgIcon>
  34. );
  35. }
  36. );
  37. IconChevron.displayName = 'IconChevron';
  38. export {IconChevron};