11import { useEffect , useRef } from "preact/hooks" ;
22
3- /**
4- * SocialShareButton Preact Wrapper
5- *
6- * Provides a lightweight Preact functional component that wraps the core
7- * SocialShareButton vanilla JS library. Handles lifecycle, dynamic updates,
8- * and browser-only initialization.
9- *
10- */
3+ /**
4+ * SocialShareButton Preact Wrapper
5+ *
6+ * Provides a lightweight Preact functional component that wraps the core
7+ * SocialShareButton vanilla JS library. Handles lifecycle, dynamic updates,
8+ * and browser-only initialization.
9+ *
10+ */
1111
1212export default function SocialShareButton ( {
1313 url = "" ,
1414 title = "" ,
1515 description = "" ,
1616 hashtags = [ ] ,
1717 via = "" ,
18- platforms = [ "whatsapp" , "facebook" , "twitter" , "linkedin" , "telegram" , "reddit" ] ,
18+ platforms = [ "whatsapp" , "facebook" , "twitter" , "linkedin" , "telegram" , "reddit" , "discord" ] ,
1919 theme = "dark" ,
2020 buttonText = "Share" ,
2121 customClass = "" ,
@@ -26,7 +26,7 @@ export default function SocialShareButton({
2626 onCopy = null ,
2727 buttonStyle = "default" ,
2828 modalPosition = "center" ,
29-
29+
3030 // Analytics props — the library emits events but never collects data itself.
3131 analytics = true ,
3232 onAnalytics = null , // (payload) => void hook
@@ -36,10 +36,10 @@ export default function SocialShareButton({
3636} ) {
3737 // DOM reference to the container where the button will be injected
3838 const containerRef = useRef ( null ) ;
39-
39+
4040 // Reference to the vanilla JS class instance
4141 const shareButtonRef = useRef ( null ) ;
42-
42+
4343 // Storage for the latest options to avoid stale closures during async initialization
4444 const latestOptionsRef = useRef ( null ) ;
4545
@@ -97,7 +97,7 @@ export default function SocialShareButton({
9797 } ;
9898
9999 // SSR Check: Ensure we're in a browser environment
100- if ( typeof window === "undefined" ) return ( ) => { } ;
100+ if ( typeof window === "undefined" ) return ( ) => { } ;
101101
102102 if ( window . SocialShareButton ) {
103103 // Core library is already loaded
@@ -135,7 +135,7 @@ export default function SocialShareButton({
135135 * Synchronizes prop changes from Preact down to the vanilla JS instance
136136 * without re-mounting the entire component.
137137 */
138-
138+
139139 // Stringify array dependencies to prevent unnecessary re-runs when
140140 // parent components pass fresh array literals on every render.
141141 const hashtagsDep = JSON . stringify ( hashtags ) ;
0 commit comments