blob: 7ba9b392079a02359577a51d741310bc63896ee1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
"use client"
import { Suspense } from "react"
import type { Tweet } from "react-tweet/api"
import {
TweetContainer,
TweetHeader,
TweetBody,
TweetMedia,
enrichTweet,
TweetSkeleton,
} from "react-tweet"
import { cn } from "@lib/utils"
import { dmSansClassName } from "@/utils/fonts"
export function TweetPreview({
data,
noBgColor,
}: {
data: Tweet
noBgColor?: boolean
}) {
const parsedTweet = typeof data === "string" ? JSON.parse(data) : data
const tweet = enrichTweet(parsedTweet)
return (
<div
className={cn(
"p-3 sm-tweet-theme w-full min-w-0",
noBgColor
? "bg-transparent rounded-none"
: "bg-[#0B1017]! rounded-[18px]",
)}
>
<Suspense fallback={<TweetSkeleton />}>
<TweetContainer
className={cn(
"pb-0! my-0! bg-transparent! border-none! w-full! min-w-0!",
dmSansClassName(),
)}
>
<TweetHeader tweet={tweet} components={{}} />
<TweetBody tweet={tweet} />
{tweet.mediaDetails?.length ? (
<TweetMedia tweet={tweet} components={{}} />
) : null}
</TweetContainer>
</Suspense>
</div>
)
}
|