mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
A continuation of #51864 with RedirectType used in an e2e test and some ts-ignores removed from the codebase. Happy to split it into two PRs but I left comments in the two consequential files ---------
31 lines
787 B
TypeScript
31 lines
787 B
TypeScript
import type { ReactNode } from 'react'
|
|
import { Tweet as ReactTweet, TweetComponents } from 'react-tweet'
|
|
import Image from 'next/image'
|
|
|
|
import { Caption } from './caption'
|
|
|
|
const components: TweetComponents = {
|
|
AvatarImg: (props) => <Image {...props} />,
|
|
MediaImg: (props) => <Image {...props} fill unoptimized />,
|
|
}
|
|
|
|
// we import this globally in the top-most layout.tsx file
|
|
// until Next.js lands suspense-y CSS support
|
|
// import "./tweet.css";
|
|
|
|
interface TweetArgs {
|
|
id: string
|
|
caption: ReactNode
|
|
}
|
|
|
|
export async function Tweet({ id, caption }: TweetArgs) {
|
|
return (
|
|
<div className="my-6">
|
|
<div className="flex justify-center">
|
|
<ReactTweet id={id} components={components} />
|
|
</div>
|
|
{caption && <Caption>{caption}</Caption>}
|
|
</div>
|
|
)
|
|
}
|