@servicensw/social

Social sharing component

Usage no npm install needed!

<script type="module">
  import servicenswSocial from 'https://cdn.skypack.dev/@servicensw/social';
</script>

README

@servicensw/social

A Social sharing widget that automatically creates sharing links for Facebook, Twitter, LinkedIn, WhatsApp, and email.

Social component

Service NSW package documentation and examples
(Login credentials required)

Installation

npm install @servicensw/social --save-dev

How to use

CSS

  • PostCSS workflow: @import '@servicensw/social';
  • Sass/Eyeglass: @import 'servicensw-social';
  • Native CSS: @import url('dist/css/social.css');
  • Link tag: <link href="dist/css/social.css" rel="stylesheet" type="text/css">

Vanilla JS

  • ES6 import: import '@servicensw/social';
  • Script tag: <script src="dist/social-sharing.js" type="text/javascript"></script>

Vanilla JS is called on DOMContentLoaded for the first #socialSharing element.

Alternatively, initialise it manually for a specific CSS selector:

(() => new SNSW.SocialSharing('#socialSharing'))();

HTML

<div id="socialSharing" class="social-sharing"></div>