bogas04 / SikhJS

👳 🚀 Gurbani Progressive Web Application
https://bogas04.github.io/SikhJS
MIT License
26 stars 16 forks source link

Add sharing button to shabads #49

Open bogas04 opened 7 years ago

bogas04 commented 7 years ago

Share as link with image of shabad and some meta data to

const format = {
  reddit(lines) { 
    return encodeURI(`${markdown(lines)}  
      [source](${url})`;
   },
   twitter(lines) {
    return rahao(lines).slice(130) + '...'; 
  },
  whatsapp(lines) {
    return ...;
  }
};
const twitter  = `https://twitter.com/intent/tweet?url=${url}&text=${format.twitter(lines)}&via=bogas04`
    , whatsapp = `whatsapp://send?text=${format.whatsapp(lines)}`
    , reddit = `https://www.reddit.com/submit?text=${format.reddit(lines)}&title=${title}`
bogas04 commented 7 years ago

clipboard.js shall come handy here

bogas04 commented 7 years ago

Added Share button for browsers that support Web Share API (Chrome 61 Android as of now).

For browsers that don't support it (pretty much all), we'll have to add new UI Component (Doorhanger?), hence it'll take some time.