Shramkoweb/Portfolio

View on GitHub
components/share-button/telegram-share.tsx

Summary

Maintainability
A
45 mins
Test Coverage
import { ShareButton } from '@/components/share-button/share-button';

export function TelegramShare() {
  const handleClick = () => {
    window.open(
      `https://telegram.me/share/url?url=${window.location.href}&text=${document.title} Blog`,
      'facebook-share-dialog',
      'width=800,height=600',
    );
  };

  return (
    <ShareButton onClick={handleClick} ariaLabel="Share this post on Telegram">
      <svg
        className="w-[18px]"
        xmlns="http://www.w3.org/2000/svg"
        viewBox="0 0 50 50"
      >
        <path
          fill="currentColor"
          d="M25 2c12.703 0 23 10.297 23 23S37.703 48 25 48 2 37.703 2 25 12.297 2 25 2zm7.934 32.375c.423-1.298 2.405-14.234 2.65-16.783.074-.772-.17-1.285-.648-1.514-.578-.278-1.434-.139-2.427.219-1.362.491-18.774 7.884-19.78 8.312-.954.405-1.856.847-1.856 1.487 0 .45.267.703 1.003.966.766.273 2.695.858 3.834 1.172 1.097.303 2.346.04 3.046-.395.742-.461 9.305-6.191 9.92-6.693.614-.502 1.104.141.602.644-.502.502-6.38 6.207-7.155 6.997-.941.959-.273 1.953.358 2.351.721.454 5.906 3.932 6.687 4.49.781.558 1.573.811 2.298.811.725 0 1.107-.955 1.468-2.064z"
        />
      </svg>
    </ShareButton>
  );
}