Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

733 B
Raw Blame
import { usePathname } from 'next/navigation'
import React, { useEffect, useState } from 'react'
import {
  LinkedinShareButton,
  LinkedinIcon,
  TwitterShareButton,
  XIcon,
} from 'react-share'

const SocialShareButton = () => {
  const [url, setUrl] = useState('')
  const pathname = usePathname()

  useEffect(() => {
    if (window !== undefined) {
      setUrl(window.location.origin + pathname)
    }
  }, [pathname])

  return (
    <div className="mt-4 space-x-2">
      <TwitterShareButton url={url}>
        <XIcon round size={38} />
      </TwitterShareButton>
      <LinkedinShareButton url={url}>
        <LinkedinIcon round size={38} />
      </LinkedinShareButton>
    </div>
  )
}

export default SocialShareButton