Skip to content

Commit 2c2b845

Browse files
authored
docs: replace deprecated interface name for Tweet components prop (#121)
1 parent 2c3ce7f commit 2c2b845

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable jsx-a11y/alt-text */
22
import Image from 'next/image'
3-
import type { TweetComponents } from 'react-tweet'
3+
import type { TwitterComponents } from 'react-tweet'
44

5-
export const components: TweetComponents = {
5+
export const components: TwitterComponents = {
66
AvatarImg: (props) => <Image {...props} />,
77
MediaImg: (props) => <Image {...props} fill unoptimized />,
88
}

apps/site/pages/next.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ In `tweet-components.tsx` or elsewhere, import the `Image` component from `next/
9090

9191
```tsx copy
9292
import Image from 'next/image'
93-
import type { TweetComponents } from 'react-tweet'
93+
import type { TwitterComponents } from 'react-tweet'
9494

95-
export const components: TweetComponents = {
95+
export const components: TwitterComponents = {
9696
AvatarImg: (props) => <Image {...props} />,
9797
MediaImg: (props) => <Image {...props} fill unoptimized />,
9898
}

apps/site/pages/twitter-theme/api-reference.mdx

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Fetches and renders the tweet. It accepts the following props:
1616
- **apiUrl** - `string`: the API URL to fetch the tweet from when using the tweet client-side with SWR. Defaults to `https://react-tweet.vercel.app/api/tweet/:id`.
1717
- **fallback** - `ReactNode`: The fallback component to render while the tweet is loading. Defaults to `TweetSkeleton`.
1818
- **onError** - `(error?: any) => any`: The returned error will be sent to the `TweetNotFound` component.
19-
- **components** - `TweetComponents`: Components to replace the default tweet components. See the [custom tweet components](#custom-tweet-components) section for more details.
19+
- **components** - `TwitterComponents`: Components to replace the default tweet components. See the [custom tweet components](#custom-tweet-components) section for more details.
2020
- **fetchOptions** - `RequestInit`: options to pass to [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
2121

2222
If the environment where `Tweet` is used does not support React Server Components then it will work with [SWR](https://swr.vercel.app/) instead and the tweet will be fetched from `https://react-tweet.vercel.app/api/tweet/:id`, which is CORS friendly.
@@ -66,7 +66,7 @@ import { EmbeddedTweet } from 'react-tweet'
6666
Renders a tweet. It accepts the following props:
6767

6868
- **tweet** - `Tweet`: the tweet data, as returned by `getTweet`. Required.
69-
- **components** - `TweetComponents`: Components to replace the default tweet components. See the [custom tweet components](#custom-tweet-components) section for more details.
69+
- **components** - `TwitterComponents`: Components to replace the default tweet components. See the [custom tweet components](#custom-tweet-components) section for more details.
7070

7171
### `TweetSkeleton`
7272

@@ -88,10 +88,10 @@ A tweet not found component. It accepts the following props:
8888

8989
## Custom tweet components
9090

91-
Default components used by [`Tweet`](#tweet) and [`EmbeddedTweet`](#embeddedtweet) can be replaced by passing a `components` prop. It extends the `TweetComponents` type exported from `react-tweet`:
91+
Default components used by [`Tweet`](#tweet) and [`EmbeddedTweet`](#embeddedtweet) can be replaced by passing a `components` prop. It extends the `TwitterComponents` type exported from `react-tweet`:
9292

9393
```ts copy
94-
type TweetComponents = {
94+
type TwitterComponents = {
9595
TweetNotFound?: (props: Props) => JSX.Element
9696
AvatarImg?: (props: AvatarImgProps) => JSX.Element
9797
MediaImg?: (props: MediaImgProps) => JSX.Element
@@ -103,9 +103,9 @@ For example, to replace the default `img` tag used for the avatar and media with
103103
```tsx copy
104104
// tweet-components.tsx
105105
import Image from 'next/image'
106-
import type { TweetComponents } from 'react-tweet'
106+
import type { TwitterComponents } from 'react-tweet'
107107

108-
export const components: TweetComponents = {
108+
export const components: TwitterComponents = {
109109
AvatarImg: (props) => <Image {...props} />,
110110
MediaImg: (props) => <Image {...props} fill unoptimized />,
111111
}

0 commit comments

Comments
 (0)