You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

back-to-content.tsx 870B

1234567891011121314151617181920212223242526272829303132
  1. import { FloatingContainer, RowButton } from 'components/shared'
  2. import { motion } from 'framer-motion'
  3. import { memo } from 'react'
  4. import state, { useSelector } from 'state'
  5. import styled from 'styles'
  6. function BackToContent() {
  7. const shouldDisplay = useSelector((s) => {
  8. const { currentShapes, shapesToRender } = s.values
  9. return currentShapes.length > 0 && shapesToRender.length === 0
  10. })
  11. if (!shouldDisplay) return null
  12. return (
  13. <BackToContentButton initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
  14. <RowButton onClick={() => state.send('ZOOMED_TO_CONTENT')}>
  15. Back to content
  16. </RowButton>
  17. </BackToContentButton>
  18. )
  19. }
  20. export default memo(BackToContent)
  21. const BackToContentButton = styled(motion(FloatingContainer), {
  22. pointerEvents: 'all',
  23. width: 'fit-content',
  24. gridRow: 1,
  25. flexGrow: 2,
  26. display: 'block',
  27. })