TwitterSocialProof.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 'use client'
  2. import Link from 'next/link'
  3. import { useRouter } from 'next/router'
  4. import { cn } from '@/lib/utils'
  5. import { TweetCard } from './TweetCard'
  6. import { range } from 'lodash'
  7. import { Tweets } from './Tweets'
  8. // import { useBreakpoint } from 'common'
  9. import React, { useEffect } from 'react'
  10. interface Props {
  11. className?: string
  12. }
  13. const TwitterSocialProof: React.FC<Props> = ({ className }) => {
  14. // const { basePath } = useRouter()
  15. const basePath = 'https://supabase.com'
  16. // const isSm = useBreakpoint()
  17. // const isMd = useBreakpoint(1024)
  18. console.log(Tweets);
  19. const tweets = Tweets.slice(0, 18)
  20. return (
  21. <>
  22. <div
  23. className={cn(
  24. 'group overflow-hidden relative transition-all max-h-[500px] w-auto flex flex-nowrap',
  25. className
  26. )}
  27. >
  28. {range(0, 3).map((_, idx1: number) => (
  29. <div
  30. key={`tweets-range-${idx1}`}
  31. className={cn(
  32. 'columns-1 sm:columns-2 md:columns-2 lg:columns-3 xl:columns-5',
  33. 'gap-4 h-fit pr-4',
  34. 'w-screen min-w-[900px] max-w-[900px]',
  35. 'xl:min-w-[1600px] max-w-[1600px]',
  36. 'animate-[marquee_40000ms_linear_both_infinite] group-hover:pause',
  37. 'motion-reduce:animate-none motion-reduce:will-change-none',
  38. 'will-change-transform transition-transform'
  39. )}
  40. >
  41. {/* {tweets.slice(0, isSm ? 9 : isMd ? 12 : 18).map((tweet: any, i: number) => ( */}
  42. {tweets.slice(0, 12).map((tweet: any, i: number) => (
  43. <Link
  44. key={tweet.text}
  45. href={tweet.url}
  46. target="_blank"
  47. className={cn(
  48. 'min-w-[200px]',
  49. 'mb-4 z-0 break-inside-avoid-column block group/tweet-card',
  50. i > 12 && 'hidden md:block'
  51. )}
  52. >
  53. <TweetCard
  54. handle={`@${tweet.handle}`}
  55. quote={tweet.text}
  56. img_url={`${basePath}${tweet.img_url}`}
  57. />
  58. </Link>
  59. ))}
  60. </div>
  61. ))}
  62. </div>
  63. <div
  64. className="
  65. absolute pointer-events-none
  66. w-full h-full max-h-[400px] lg:max-h-none
  67. inset-0 top-auto
  68. lg:bg-[radial-gradient(50%_100%_at_50%_0,transparent_0%,transparent_50%,hsl(var(--background-default))_100%)]
  69. "
  70. />
  71. </>
  72. )
  73. }
  74. export default TwitterSocialProof