splitDivider.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {DOMAttributes} from 'react';
  2. import styled from '@emotion/styled';
  3. import {IconGrabbable} from 'sentry/icons';
  4. import {space} from 'sentry/styles/space';
  5. type Props = {
  6. isHeld: boolean;
  7. slideDirection: 'leftright' | 'updown';
  8. };
  9. const SplitDivider = styled(
  10. ({isHeld: _a, slideDirection: _b, ...props}: Props & DOMAttributes<HTMLDivElement>) => (
  11. <div {...props}>
  12. <IconGrabbable size="sm" />
  13. </div>
  14. )
  15. )<Props>`
  16. display: grid;
  17. place-items: center;
  18. height: 100%;
  19. width: 100%;
  20. user-select: ${p => (p.isHeld ? 'none' : 'inherit')};
  21. background: ${p => (p.isHeld ? p.theme.hover : 'inherit')};
  22. :hover {
  23. background: ${p => p.theme.hover};
  24. }
  25. ${p =>
  26. p.slideDirection === 'leftright'
  27. ? `
  28. cursor: ew-resize;
  29. height: 100%;
  30. width: ${space(2)};
  31. `
  32. : `
  33. cursor: ns-resize;
  34. width: 100%;
  35. height: ${space(2)};
  36. & > svg {
  37. transform: rotate(90deg);
  38. }
  39. `}
  40. `;
  41. export default SplitDivider;