vercel / react-tweet

Embed tweets in your React application.
https://react-tweet.vercel.app
MIT License
1.6k stars 86 forks source link

Make `react-tweet` more customizable #86

Closed lfades closed 1 year ago

lfades commented 1 year ago

The components in react-tweet have been re-organized in a way that the transformations to the tweet data now come from utility functions, which are also exported so that other custom components can use the same utility functions.

An app called custom-tweet-dub has been added and it uses the tweet theme from https://dub.sh/

I'm still thinking if using utility functions to manipulate the tweet data is better than having a more poweful function that returns all the utility functions applied and that way you don't have to call them.

In case you're curious why didn't I extend the components similarly to MDX components, the answer is RSC. In server components you can't pass down functions to a client component because they're not serializable, so as soon as you hit a client component, you won't be able to pass a component map.

Update:

Added a more general utility to add additional data to the tweet. Now the other utils are not being exported.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-tweet-site ✅ Ready (Inspect) Visit Preview 💬 1 unresolved Jun 30, 2023 4:44pm
4 Ignored Deployments | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **react-tweet-create-react-app** | ⬜️ Ignored ([Inspect](https://vercel.com/vercel-labs/react-tweet-create-react-app/AbEZwupjpGKXmt2nrfWfTvEDjDtv)) | [Visit Preview](https://react-tweet-create-react-app-git-lfades-dx-1-23a5d9-vercel-labs.vercel.app) | | Jun 30, 2023 4:44pm | | **react-tweet-custom-tweet-dub** | ⬜️ Ignored ([Inspect](https://vercel.com/vercel-labs/react-tweet-custom-tweet-dub/AnpPSqiiqKCazpAdCQCZQUquX89x)) | [Visit Preview](https://react-tweet-custom-tweet-dub-git-lfades-dx-1-58a2b7-vercel-labs.vercel.app) | | Jun 30, 2023 4:44pm | | **react-tweet-next-app** | ⬜️ Ignored ([Inspect](https://vercel.com/vercel-labs/react-tweet-next-app/7Zv3wwzk74D1QkrNhCUJGDco1RK4)) | [Visit Preview](https://react-tweet-next-app-git-lfades-dx-1498-make-fb9015-vercel-labs.vercel.app) | | Jun 30, 2023 4:44pm | | **react-tweet-vite-app** | ⬜️ Ignored ([Inspect](https://vercel.com/vercel-labs/react-tweet-vite-app/AWhGL9KyBucTkzCGcKQUoK9hEVEd)) | [Visit Preview](https://react-tweet-vite-app-git-lfades-dx-1498-make-ea1019-vercel-labs.vercel.app) | | Jun 30, 2023 4:44pm |