@@ -19,14 +19,15 @@ class SocialShareButton {
1919 description : options . description || "" ,
2020 hashtags : options . hashtags || [ ] ,
2121 via : options . via || "" ,
22- platforms : options . platforms || [
23- "whatsapp" ,
24- "facebook" ,
25- "twitter" ,
26- "linkedin" ,
27- "telegram" ,
28- "reddit" ,
29- ] ,
22+ platforms : options . platforms || [
23+ "whatsapp" ,
24+ "facebook" ,
25+ "twitter" ,
26+ "linkedin" ,
27+ "telegram" ,
28+ "reddit" ,
29+ "pinterest"
30+ ] ,
3031 theme : options . theme || "dark" ,
3132 buttonText : options . buttonText || "Share" ,
3233 customClass : options . customClass || "" ,
@@ -168,8 +169,13 @@ class SocialShareButton {
168169 } ,
169170 email : {
170171 name : "Email" ,
171- color : "#7f7f7f" ,
172- icon : '<path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/>' ,
172+ color : '#7f7f7f' ,
173+ icon : '<path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/>'
174+ } ,
175+ pinterest : {
176+ name : "Pinterest" ,
177+ color : '#E60023' ,
178+ icon : '<path d="M12 0C5.372 0 0 5.373 0 12c0 4.99 3.052 9.267 7.386 11.059-.102-.94-.194-2.385.04-3.413.211-.904 1.356-5.752 1.356-5.752s-.346-.693-.346-1.717c0-1.608.932-2.808 2.093-2.808.987 0 1.463.741 1.463 1.63 0 .993-.632 2.476-.958 3.853-.273 1.155.58 2.098 1.718 2.098 2.062 0 3.646-2.174 3.646-5.31 0-2.778-1.997-4.722-4.847-4.722-3.304 0-5.242 2.478-5.242 5.039 0 .997.384 2.066.865 2.647.095.115.109.215.08.331-.088.365-.282 1.155-.321 1.316-.05.212-.165.257-.381.155-1.418-.66-2.305-2.733-2.305-4.397 0-3.579 2.601-6.867 7.497-6.867 3.936 0 6.998 2.805 6.998 6.557 0 3.91-2.466 7.058-5.892 7.058-1.15 0-2.232-.597-2.6-1.302l-.707 2.692c-.255.983-.946 2.215-1.408 2.966A12.002 12.002 0 0024 12C24 5.373 18.627 0 12 0z"/>'
173179 } ,
174180 } ;
175181
@@ -197,13 +203,8 @@ class SocialShareButton {
197203 const hashtagString = hashtags . length ? "#" + hashtags . join ( " #" ) : "" ;
198204
199205 // Build platform-specific messages with customizable parameters
200- let whatsappMessage ,
201- facebookMessage ,
202- twitterMessage ,
203- telegramMessage ,
204- redditTitle ,
205- emailBody ;
206-
206+ let whatsappMessage , facebookMessage , twitterMessage , telegramMessage , redditTitle , emailBody , pinterestText ;
207+
207208 // WhatsApp: Casual with emoji
208209 whatsappMessage = `\u{1F680} ${ title } ${ description ? "\n\n" + description : "" } ${ hashtagString ? "\n\n" + hashtagString : "" } \n\nLive on the site \u{1F440}\nClean UI, smooth flow \u{2014} worth peeking\n\u{1F447}` ;
209210
@@ -221,13 +222,17 @@ class SocialShareButton {
221222
222223 // Email: Friendly greeting
223224 emailBody = `Hey \u{1F44B}\n\nSharing a clean project I came across:\n${ title } ${ description ? "\n\n" + description : "" } \n\nLive, simple, and usable \u{2014} take a look \u{1F447}` ;
224-
225+
226+ // Pinterest: Title + Description
227+ pinterestText = `${ title || '' } ${ description ? ' - ' + description : '' } ` ;
228+
225229 const encodedWhatsapp = encodeURIComponent ( whatsappMessage ) ;
226230 const encodedFacebook = encodeURIComponent ( facebookMessage ) ;
227231 const encodedTwitter = encodeURIComponent ( twitterMessage ) ;
228232 const encodedTelegram = encodeURIComponent ( telegramMessage ) ;
229233 const encodedReddit = encodeURIComponent ( redditTitle ) ;
230234 const encodedEmail = encodeURIComponent ( emailBody ) ;
235+ const encodedPinterest = encodeURIComponent ( pinterestText ) ;
231236
232237 const urls = {
233238 whatsapp : `https://wa.me/?text=${ encodedWhatsapp } %20${ encodedUrl } ` ,
@@ -237,6 +242,7 @@ class SocialShareButton {
237242 telegram : `https://t.me/share/url?url=${ encodedUrl } &text=${ encodedTelegram } ` ,
238243 reddit : `https://reddit.com/submit?url=${ encodedUrl } &title=${ encodedReddit } ` ,
239244 email : `mailto:?subject=${ encodedTitle } &body=${ encodedEmail } %20${ encodedUrl } ` ,
245+ pinterest : `https://pinterest.com/pin/create/button/?url=${ encodedUrl } &description=${ encodedPinterest } ` ,
240246 } ;
241247
242248 return urls [ platform ] || "" ;
0 commit comments