From 7d07c4fe67dceb9ef359f8686c897b99bb086ebe Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Wed, 25 Mar 2020 22:11:25 +0100 Subject: [PATCH] Add Telegram --- src/index.ts | 1 + src/style.scss | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/index.ts b/src/index.ts index 76a9deb..ceb10a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,7 @@ interface PublishPreset { type UrlBuilder = (data: PublishPreset) => string; const NETWORKS: { [name: string]: UrlBuilder } = { + telegram: (d) => `https://telegram.me/share/url?url=${encodeURIComponent(d.url)}${(d.extra && d.extra.text) ? `&text=${encodeURIComponent(d.extra.text)}` : ''}`, }; function initShareonChild(child: HTMLElement, preset: PublishPreset) { diff --git a/src/style.scss b/src/style.scss index 08b51ae..e057a5f 100644 --- a/src/style.scss +++ b/src/style.scss @@ -64,6 +64,15 @@ $width: $button-size - 2*$padding-hor; content: ''; vertical-align: bottom; } + + + &.telegram { + background-color: #27A7E5; + + &::before { + background-image: url("data:image/svg+xml,%3Csvg viewBox='4.4 5 14 14' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M4.987 11.948c3.69-1.487 6.151-2.468 7.382-2.941 3.515-1.352 4.245-1.587 4.721-1.595.105-.002.339.022.491.136a.482.482 0 01.18.317c.017.091.038.299.021.461-.19 1.851-1.015 6.343-1.434 8.417-.177.877-.529 1.065-.867 1.094-.736.062-1.291-.343-2.003-.775-1.114-.675-1.788-.987-2.869-1.646-1.25-.762-.15-1.118.562-1.802.186-.179 3.371-3.042 3.357-3.128-.005-.032-.099-.34-.173-.401s-.184-.04-.262-.024c-.112.024-1.892 1.112-5.339 3.264-.506.321-.963.477-1.373.469-.452-.009-1.321-.236-1.968-.43-.792-.239-1.085-.351-1.03-.756.028-.211.23-.431.604-.66z'/%3E%3C/svg%3E"); + } + } } }