How sakerhetspolisen/react-share-on-social works
This is a small React sharing component: a user activates its child element, the component uses the native Web Share API when available, and otherwise opens a portal-rendered fallback with social-sharing and copy-link actions. The main entry point and selected component implementations are sampled; Portal and Close are present in the tree but their source was not sampled, so their internal behavior is not expanded.
Main entry points: index.tsx ShareOnSocial · Popup.tsx Fallback popup · SocialButton.tsx Social button · Backdrop.tsx Backdrop
Components 14
Other components
- User
- ShareOnSocial
src/index.tsx - Disclosure state
src/hooks/use-disclosure.tsx - Web Share API
- Portal
src/components/Portal.tsx - Backdrop
src/components/Backdrop.tsx - Fallback popup
src/components/Popup.tsx - Link preview
src/components/Header.tsx - Social button
src/components/SocialButton.tsx - Social definitions
src/config/socials.tsx - Copy link
src/components/CopyToClipboard.tsx - Clipboard package
- Social services
- Close button
src/components/Close.tsx
Connections 15
- User → ShareOnSocial: clicks trigger
- ShareOnSocial → Web Share API: calls if supported
- ShareOnSocial → Disclosure state: opens or closes
- ShareOnSocial → Portal: renders fallback
- ShareOnSocial → Backdrop: renders overlay
- ShareOnSocial → Fallback popup: renders dialog
- Backdrop → ShareOnSocial: calls close handler
- Fallback popup → Link preview: renders preview
- Fallback popup → Social button: renders channels
- Fallback popup → Copy link: renders copy action
- Fallback popup → Close button: renders close action
- Social button → Social definitions: reads channel URL
- Social button → Social services: opens share URL
- Social button → ShareOnSocial: calls click and close callbacks
- Copy link → Clipboard package: copies link