diff --git a/README.md b/README.md index b562a45..cd5c454 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,39 @@ Embed Bluesky comments on your website easily. **[Write up and demo here](https://coryzue.com/writing/bluesky-comments).** +## Installation in a Node.js project as a React component -## Installation via CDNs (easiest) +To use this library in a React project, first install the library: -There are a few ways to set up the library on your website. +```bash +npm install bluesky-comments +``` + +Then import it (and the CSS) in your React app/page/component: + +```tsx +import 'bluesky-comments/bluesky-comments.css' +import { BlueskyComments } from 'bluesky-comments'; +``` + +And use it in any React component like this: + +```javascript +function App() { + return ( + <> +
- {author.displayName ?? author.handle}{" "} + {author.displayName ?? author.handle}{' '} @{author.handle}
@@ -51,7 +53,9 @@ export const Comment = ({ comment, filters }: CommentProps) => {{post.repostCount ?? 0}
{post.likeCount ?? 0}
-
- Join the conversation by replying on Bluesky. + Join the conversation by{' '} + + replying on Bluesky + + .
> ); diff --git a/src/main.tsx b/src/main.tsx index 9069608..0a3f401 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,35 +1,2 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { CommentSection } from './CommentSection' -import { Filters } from './CommentFilters' -import type { CommentOptions } from './types' - -export const BlueskyComments = { - init: function(elementId: string, options: CommentOptions) { - const element = document.getElementById(elementId) - if (!element) return; - - ReactDOM.createRoot(element).render( -