Skip to content

Commit

Permalink
feat(ui): create utterances comments component
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Jul 3, 2023
1 parent dd2c352 commit 8a8c2d3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/app/(blog)/post/[slug]/components/utterances-comments.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use client'

import { useEffect, useRef } from 'react'

export function UtterancesComments() {
const ref = useRef<HTMLDivElement | null>(null)

useEffect(() => {
const scriptElement = document.createElement('script')
scriptElement.src = 'https://utteranc.es/client.js'
scriptElement.setAttribute('repo', 'mateusfg7/_mfg-b_articles')
scriptElement.setAttribute('issue-term', 'og:title')
scriptElement.setAttribute('label', 'comment')
scriptElement.setAttribute('theme', 'preferred-color-scheme')
scriptElement.crossOrigin = 'anonymous'
scriptElement.async = true

ref.current?.appendChild(scriptElement)
}, [])

return <div ref={ref} />
}

0 comments on commit 8a8c2d3

Please sign in to comment.