social-share-web
v0.0.1
Published
Social Share plugin is made from new UI perspective. Also for angular it takes care of SSR as it takes `document` as input. It can be used for all frameworks which uses typescript.
Downloads
40
Maintainers
Readme
Social Share
Social Share plugin is made from new UI perspective. Also for angular it takes care of SSR as it takes document
as input. It can be used for all frameworks which uses typescript.
Features
- Buffer
- DSCVR
- Hacker News
- Line
- Open Chat
- Telegram
- Tumbler
Instalation
npm install social-share-web
Getting Started
Both show
, hide
and share
methods are published. So that you can directly share with the help of specified attributes.
show(options)
Triggers the modal and needs to provide options for dynamic usage.
hide(document)
Clears the modal from the DOM
share(document, type, attributes)
Execute directly
Example
import { SocialMedia, SocialShare } from 'social-share-web';
private readonly shareObj = new SocialShare();
openShareModal() {
this.shareObj.show({
doc: document,
title: "Social Modal",
message: "Share this link via",
socials: {
[SocialMedia.Facebook]: {
type: 'feed'
},
[SocialMedia.LinkedIn]: {
url: window.location.href
},
[SocialMedia.Whatsapp]: {
url: window.location.href,
text: "Hi Sage Savas"
},
[SocialMedia.Pinterest]: {
url: window.location.href
},
[SocialMedia.Reddit]: {
url: window.location.href
},
[SocialMedia.Twitter]: {
url: window.location.href
},
[SocialMedia.Dscvr]: {
url: window.location.href
},
[SocialMedia.HackerNews]: {
url: window.location.href
},
[SocialMedia.OpenChat]: {
url: window.location.href
},
[SocialMedia.Telegram]: {
url: window.location.href
},
[SocialMedia.Email]: {
to: '[email protected]'
},
[SocialMedia.Pocket]: {
url: window.location.href
},
[SocialMedia.Buffer]: {
url: window.location.href,
text: 'Something'
}
},
copy: {
url: 'https://www.domain.com',
text: 'Domain'
}
});
}
directShare(doc: Document, type: SocialMedia, attributes: any) {
this.shareObj.share(doc, type, attributes);
}
close() {
this.shareObj.hide(doc: Document);
}