-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.tsx
35 lines (31 loc) · 1.03 KB
/
main.tsx
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
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(
<React.StrictMode>
<CommentSection
uri={options.uri}
author={options.author}
onEmpty={options.onEmpty}
commentFilters={options.commentFilters}
/>
</React.StrictMode>
)
},
Filters
}
// Support both module exports and window global
// Add to window object for UMD builds
if (typeof window !== 'undefined') {
(window as any).BlueskyComments = BlueskyComments;
// For backward compatibility
(window as any).initBlueskyComments = BlueskyComments.init;
}
export { CommentSection } from './CommentSection'
export { Filters } from './CommentFilters'