Skip to content

Commit cee4918

Browse files
authored
Merge pull request #427 from cdransf/master
Render floating comment button only if a provider is specified
2 parents 3fd5c62 + 484296a commit cee4918

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

components/ScrollTopAndComment.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import siteMetadata from '@/data/siteMetadata'
12
import { useEffect, useState } from 'react'
23
import smoothscroll from 'smoothscroll-polyfill'
34

@@ -25,20 +26,22 @@ const ScrollTopAndComment = () => {
2526
<div
2627
className={`fixed right-8 bottom-8 hidden flex-col gap-3 ${show ? 'md:flex' : 'md:hidden'}`}
2728
>
28-
<button
29-
aria-label="Scroll To Comment"
30-
type="button"
31-
onClick={handleScrollToComment}
32-
className="rounded-full bg-gray-200 p-2 text-gray-500 transition-all hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-400 dark:hover:bg-gray-600"
33-
>
34-
<svg className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
35-
<path
36-
fillRule="evenodd"
37-
d="M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z"
38-
clipRule="evenodd"
39-
/>
40-
</svg>
41-
</button>
29+
{siteMetadata.comment.provider && (
30+
<button
31+
aria-label="Scroll To Comment"
32+
type="button"
33+
onClick={handleScrollToComment}
34+
className="rounded-full bg-gray-200 p-2 text-gray-500 transition-all hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-400 dark:hover:bg-gray-600"
35+
>
36+
<svg className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
37+
<path
38+
fillRule="evenodd"
39+
d="M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z"
40+
clipRule="evenodd"
41+
/>
42+
</svg>
43+
</button>
44+
)}
4245
<button
4346
aria-label="Scroll To Top"
4447
type="button"

0 commit comments

Comments
 (0)