pageCorners.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import styled from '@emotion/styled';
  2. import {AnimationControls, motion} from 'framer-motion';
  3. import testableTransition from 'sentry/utils/testableTransition';
  4. type Props = {
  5. animateVariant: AnimationControls;
  6. };
  7. const PageCorners = ({animateVariant}: Props) => (
  8. <Container>
  9. <TopRight
  10. key="tr"
  11. width="874"
  12. height="203"
  13. viewBox="0 0 874 203"
  14. fill="none"
  15. xmlns="http://www.w3.org/2000/svg"
  16. animate={animateVariant}
  17. >
  18. <path
  19. d="M36.5 0H874v203l-288.7-10-7-114-180.2-4.8-3.6-35.2-351.1 2.5L36.5 0z"
  20. fill="currentColor"
  21. />
  22. <path
  23. d="M535.5 111.5v-22l31.8 1 .7 21.5-32.5-.5zM4 43.5L0 21.6 28.5 18l4.2 24.7-28.7.8z"
  24. fill="currentColor"
  25. />
  26. </TopRight>
  27. <BottomLeft
  28. key="bl"
  29. width="494"
  30. height="141"
  31. viewBox="0 0 494 141"
  32. fill="none"
  33. xmlns="http://www.w3.org/2000/svg"
  34. animate={animateVariant}
  35. >
  36. <path d="M494 141H-1V7l140-7v19h33l5 82 308 4 9 36z" fill="currentColor" />
  37. <path d="M219 88h-30l-1-19 31 3v16z" fill="currentColor" />
  38. </BottomLeft>
  39. <TopLeft
  40. key="tl"
  41. width="414"
  42. height="118"
  43. fill="none"
  44. xmlns="http://www.w3.org/2000/svg"
  45. animate={animateVariant}
  46. >
  47. <path
  48. fillRule="evenodd"
  49. clipRule="evenodd"
  50. d="M414 0H0v102h144l5-69 257-3 8-30zM0 112v-10h117v16L0 112z"
  51. fill="currentColor"
  52. />
  53. <path d="M184 44h-25l-1 16 26-2V44z" fill="currentColor" />
  54. </TopLeft>
  55. <BottomRight
  56. key="br"
  57. width="650"
  58. height="151"
  59. fill="none"
  60. xmlns="http://www.w3.org/2000/svg"
  61. animate={animateVariant}
  62. >
  63. <path
  64. fillRule="evenodd"
  65. clipRule="evenodd"
  66. d="M27 151h623V0L435 7l-5 85-134 4-3 26-261-2-5 31z"
  67. fill="currentColor"
  68. />
  69. <path d="M398 68v16h24l1-16h-25zM3 119l-3 16 21 3 3-19H3z" fill="currentColor" />
  70. </BottomRight>
  71. </Container>
  72. );
  73. export default PageCorners;
  74. const transition = testableTransition({
  75. type: 'spring',
  76. duration: 0.8,
  77. });
  78. const TopLeft = styled(motion.svg)`
  79. position: absolute;
  80. top: 0;
  81. left: 0;
  82. `;
  83. TopLeft.defaultProps = {
  84. initial: {x: '-40px', opacity: 0},
  85. variants: {
  86. 'top-right': {x: '-40px', opacity: 0},
  87. 'top-left': {x: 0, opacity: 1},
  88. },
  89. transition,
  90. };
  91. const TopRight = styled(motion.svg)`
  92. position: absolute;
  93. top: 0;
  94. right: 0;
  95. `;
  96. TopRight.defaultProps = {
  97. initial: {x: '40px', opacity: 0},
  98. variants: {
  99. 'top-left': {x: '40px', opacity: 0},
  100. 'top-right': {x: 0, opacity: 1},
  101. },
  102. transition,
  103. };
  104. const BottomLeft = styled(motion.svg)`
  105. position: absolute;
  106. bottom: 0;
  107. left: 0;
  108. `;
  109. BottomLeft.defaultProps = {
  110. initial: {x: '-40px', opacity: 0},
  111. variants: {
  112. 'top-left': {x: '-40px', opacity: 0},
  113. 'top-right': {x: 0, opacity: 1},
  114. },
  115. transition,
  116. };
  117. const BottomRight = styled(motion.svg)`
  118. position: absolute;
  119. bottom: 0;
  120. right: 0;
  121. `;
  122. BottomRight.defaultProps = {
  123. initial: {x: '40px', opacity: 0},
  124. variants: {
  125. 'top-right': {x: '40px', opacity: 0},
  126. 'top-left': {x: 0, opacity: 1},
  127. },
  128. transition,
  129. };
  130. const Container = styled('div')`
  131. pointer-events: none;
  132. position: absolute;
  133. top: 0;
  134. left: 0;
  135. right: 0;
  136. bottom: 0;
  137. color: ${p => p.theme.purple200};
  138. opacity: 0.4;
  139. `;