web-social-share
Version:
A Web Component to share urls and text on social networks
16 lines (15 loc) • 673 B
JavaScript
import { openNewWindow, shareEncodedUrl } from "../utils/utils";
export const dscvr = async ({ socialShareUrl, socialShareText, socialShareTitle, socialSharePortal, openWindowTarget: target }) => {
let urlString = `https://dscvr.one/?url=${shareEncodedUrl(socialShareUrl)}`;
if (socialShareText) {
urlString += `&text=${encodeURIComponent(socialShareText)}`;
}
if (socialShareTitle) {
urlString += '&title=' + encodeURIComponent(socialShareTitle);
}
if (socialSharePortal) {
urlString += '&portal=' + encodeURIComponent(socialSharePortal);
}
openNewWindow({ urlString, target });
};
//# sourceMappingURL=dscvr.js.map