mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 10:19:13 +03:00
gitalk to snippet page
This commit is contained in:
parent
29025c3d1a
commit
839b708fdd
@ -111,18 +111,20 @@ const Article = ({
|
|||||||
<div className="article-comments">
|
<div className="article-comments">
|
||||||
<div className="article-comments__heading">
|
<div className="article-comments__heading">
|
||||||
<h2>Комментарии</h2>
|
<h2>Комментарии</h2>
|
||||||
{readyComments ? <GitalkComponent
|
{readyComments ? (
|
||||||
|
<GitalkComponent
|
||||||
options={{
|
options={{
|
||||||
clientID,
|
clientID,
|
||||||
clientSecret,
|
clientSecret,
|
||||||
repo,
|
repo,
|
||||||
owner,
|
owner,
|
||||||
admin: admin.split(","),
|
admin: admin.split(","),
|
||||||
language: 'ru',
|
language: "ru",
|
||||||
id: pathname,
|
id: pathname,
|
||||||
title: title,
|
title: title,
|
||||||
}}
|
}}
|
||||||
/> : null}
|
/>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="article-comments__content"></div>
|
<div className="article-comments__content"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,7 +1,20 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
|
import { useLocation } from "@reach/router"
|
||||||
|
import GitalkComponent from "gitalk/dist/gitalk-component"
|
||||||
|
import useSiteMetadataQuery from "../../hooks/useSiteMetadataQuery"
|
||||||
|
|
||||||
const Snippet = ({ data: { description, title, date }, html }) => {
|
const Snippet = ({ data: { description, title, date }, html }) => {
|
||||||
|
const {
|
||||||
|
siteMetadata: {
|
||||||
|
gitalk: { clientID, clientSecret, repo, owner, admin },
|
||||||
|
},
|
||||||
|
} = useSiteMetadataQuery()
|
||||||
|
const { pathname } = useLocation()
|
||||||
|
const [readyComments, setReadyComments] = React.useState(false)
|
||||||
|
|
||||||
|
React.useEffect(() => setReadyComments(true), [setReadyComments])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="snippet">
|
<div className="snippet">
|
||||||
@ -19,6 +32,20 @@ const Snippet = ({ data: { description, title, date }, html }) => {
|
|||||||
<div className="snippet-comments">
|
<div className="snippet-comments">
|
||||||
<div className="snippet-comments__heading">
|
<div className="snippet-comments__heading">
|
||||||
<h2>Комментарии</h2>
|
<h2>Комментарии</h2>
|
||||||
|
{readyComments ? (
|
||||||
|
<GitalkComponent
|
||||||
|
options={{
|
||||||
|
clientID,
|
||||||
|
clientSecret,
|
||||||
|
repo,
|
||||||
|
owner,
|
||||||
|
admin: admin.split(","),
|
||||||
|
language: "ru",
|
||||||
|
id: pathname,
|
||||||
|
title: title,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="snippet-comments__content"></div>
|
<div className="snippet-comments__content"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user