index.tsx 960 B

1234567891011121314151617181920212223242526272829303132
  1. import React, { useEffect } from 'react'
  2. import styles from './index.module.scss'
  3. import isMobile from '@/utils/isMobile'
  4. const Background = ({ activeIndex }: { activeIndex: number }) => {
  5. return (
  6. <div className={styles.bg}>
  7. <img
  8. key="bg3 "
  9. className={`bgImg1 ${activeIndex === 2 ? 'enter' : 'leave'}`}
  10. src={require(`../../image/caro3/${isMobile() ? 'bg3_M' : 'bg3'}.png`)}
  11. alt=''
  12. draggable='false'
  13. />
  14. <img
  15. key="bg2"
  16. className={`bgImg2 ${activeIndex === 1 ? 'enter' : 'leave'}`}
  17. src={require(`../../image/caro2/${isMobile() ? 'bg2_M' : 'bg2'}.png`)}
  18. alt=''
  19. draggable='false'
  20. />
  21. <img
  22. key="bg1"
  23. className={`bgImg3 ${activeIndex === 0 ? 'enter' : 'leave'}`}
  24. src={require(`../../image/caro1/${isMobile() ? 'bg1_M' : 'bg1'}.png`)}
  25. alt=''
  26. draggable='false'
  27. />
  28. </div>
  29. )
  30. }
  31. export default Background