diff --git a/components/comments/index.tsx b/components/comments/index.tsx new file mode 100644 index 0000000..8c8d9c0 --- /dev/null +++ b/components/comments/index.tsx @@ -0,0 +1,31 @@ +import { Box, useColorMode } from '@chakra-ui/react'; +import React, { useRef, useEffect } from 'react'; + +const Comments = () => { + const commentBox = useRef(null); + const { colorMode } = useColorMode(); + + useEffect(() => { + const commentScript = document.createElement('script'); + const theme = colorMode === 'light' ? 'github-light' : 'github-dark'; + + commentScript.setAttribute('src', 'https://utteranc.es/client.js'); + commentScript.setAttribute('repo', 'knowankit/knowankit.com'); + commentScript.setAttribute('theme', theme); + commentScript.setAttribute('crossorigin', 'anonymous'); + commentScript.setAttribute('async', 'true'); + commentScript.setAttribute('issue-term', 'pathname'); + + if (commentBox && commentBox.current) { + commentBox.current.appendChild(commentScript); + } + }, []); + + return ( + + + + ); +}; + +export default Comments; diff --git a/components/homepage/recent-project-card.tsx b/components/homepage/recent-project-card.tsx index 38f6279..cfc6e3b 100644 --- a/components/homepage/recent-project-card.tsx +++ b/components/homepage/recent-project-card.tsx @@ -2,50 +2,54 @@ import React from 'react'; import { Box, Heading, Text, Stack, Avatar, useColorModeValue } from '@chakra-ui/react'; import { AiFillGithub } from 'react-icons/ai'; +import Link from 'next/link'; const ProjectCard = ({ project }) => { return ( - - - - Project - - - {project.name} - - {/* + + + + + Project + + + {project.name} + + {/* {project.description} */} - - {project.demo && ( - - Preview - - )} - {project.github && ( - - - - )} - - - + + {project.demo && ( + + Preview + + )} + {project.github && ( + + + + )} + + + + ); }; diff --git a/components/mdx/index.tsx b/components/mdx/index.tsx index 115dacd..f7b1db2 100644 --- a/components/mdx/index.tsx +++ b/components/mdx/index.tsx @@ -9,6 +9,7 @@ const SocialShare = dynamic( ssr: false } ); + const CustomLink = (props) => { const href = props.href; const isInternalLink = href && (href.startsWith('/') || href.startsWith('#')); diff --git a/components/projects/project-card.tsx b/components/projects/project-card.tsx index b69a6c9..9ec2e96 100644 --- a/components/projects/project-card.tsx +++ b/components/projects/project-card.tsx @@ -2,48 +2,52 @@ import React from 'react'; import { Box, Heading, Text, Stack, useColorModeValue } from '@chakra-ui/react'; import { AiFillGithub } from 'react-icons/ai'; +import Link from 'next/link'; const ProjectCard = ({ project }) => { return ( - - - - Project - - - {project.name} - - {project.description} - - {project.demo && ( - - Preview - - )} - {project.github && ( - - - - )} - - - + + + + + Project + + + {project.name} + + {project.description} + + {project.demo && ( + + Preview + + )} + {project.github && ( + + + + )} + + + + ); }; diff --git a/data/blog/hydrate-redux-state-in-nextjs.mdx b/data/blog/hydrate-redux-state-in-nextjs.mdx index ce504b2..dc7415b 100644 --- a/data/blog/hydrate-redux-state-in-nextjs.mdx +++ b/data/blog/hydrate-redux-state-in-nextjs.mdx @@ -170,3 +170,5 @@ Do check it out.
Thank You! 👋🏻 + +--- diff --git a/layouts/blog-layout.tsx b/layouts/blog-layout.tsx index ffdc7b7..4342ad8 100644 --- a/layouts/blog-layout.tsx +++ b/layouts/blog-layout.tsx @@ -6,6 +6,11 @@ import { prismDarkTheme } from '@/styles/style'; import FrontMatter from '@/components/front-matter'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import dynamic from 'next/dynamic'; + +const Comments = dynamic(import(/* webpackChunkName: "SocialShare" */ 'components/comments'), { + ssr: false +}); type Props = { children: JSX.Element; @@ -52,6 +57,7 @@ const BlogLayout: FC = ({ children, frontMatter }) => { flexDirection="column"> {children} +