{"version":3,"file":"CustomShareButton.DwgVfeEr.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/QRp7AyrN1gzcaKo1J5g0/R2U7HEx9pz26joJOtqGe/CustomShareButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CustomShareButton(props){var _props_iconImage;const[isHovered,setIsHovered]=useState(false);const handleMouseEnter=()=>{setIsHovered(true);};const handleMouseLeave=()=>{setIsHovered(false);};// TO DO: handler all platform in a dropdown\n// Pick URL from browser\nconst shareOnX=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const xShareUrl=`https://twitter.com/intent/tweet?text=${title}%0D%0D&url=${url}`;window.open(xShareUrl,\"_blank\");};const shareOnLinkedIn=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const linkedinShareUrl=`https://www.linkedin.com/shareArticle?mini=true&url=${url}%2F&title=${title}&summary=`;window.open(linkedinShareUrl,\"_blank\");};const shareOnFacebook=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const facebookShareUrl=`https://www.facebook.com/sharer/sharer.php?u=${url}`;window.open(facebookShareUrl,\"_blank\");};const shareOnPinterest=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const PiShareUrl=`https://www.pinterest.com/pin/create/button/?&text=${title}&url=${url}&description=${title}`;window.open(PiShareUrl,\"_blank\");};const shareOnWhatsapp=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const whShareUrl=`https://api.whatsapp.com/send?text=${title}%20${url}`;window.open(whShareUrl,\"_blank\");};const shareOnTelegram=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const telegramShareUrl=`https://t.me/share/url?url=${url}&text=${title}`;window.open(telegramShareUrl,\"_blank\");};const shareOnReddit=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const redditShareUrl=`https://reddit.com/submit?url=${url}&title=${title}`;window.open(redditShareUrl,\"_blank\");};const shareOnHackerNews=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const hackernewsShareUrl=`https://news.ycombinator.com/submitlink?u=${url}&t=${title}`;window.open(hackernewsShareUrl,\"_blank\");};const shareOnEmail=()=>{const url=encodeURIComponent(window.location.href);const title=encodeURIComponent(document.title);const emailShareUrl=`mailto:?subject=${title}&body=${url}`;window.open(emailShareUrl,\"_blank\");};const shareOnClipboard=()=>{const url=window.location.href;navigator.clipboard.writeText(url);};const handleShare=()=>{switch(props.platform){case\"X\":shareOnX();break;case\"Facebook\":shareOnFacebook();break;case\"LinkedIn\":shareOnLinkedIn();break;case\"Pinterest\":shareOnPinterest();break;case\"Whatsapp\":shareOnWhatsapp();break;case\"Telegram\":shareOnTelegram();break;case\"Reddit\":shareOnReddit();break;case\"Hacker News\":shareOnHackerNews();break;case\"Email\":shareOnEmail();break;case\"Clipboard\":shareOnClipboard();break;default:console.log(\"Unsupported platform\");}};return /*#__PURE__*/_jsx(\"button\",{onClick:handleShare,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,style:{width:\"auto\",height:\"auto\",backgroundColor:props.backgroundcolor,borderRadius:props.radius,padding:props.padding,borderColor:props.borderproperties.color,borderWidth:props.borderproperties.width,borderStyle:props.borderproperties.style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",opacity:isHovered?.8:1},children:/*#__PURE__*/_jsx(\"img\",{src:((_props_iconImage=props.iconImage)===null||_props_iconImage===void 0?void 0:_props_iconImage.src)||\"https://img.icons8.com/?size=100&id=fJp7hepMryiw&format=png&color=ffffff\",alt:props.iconAlt,width:props.iconWidth})},props.iconAlt);}CustomShareButton.defaultProps={iconWidth:24,platform:\"Twitter\",backgroundColor:\"#212121\",borderRadius:16,padding:16,borderColor:\"#222222\",borderWidth:0,borderStyle:\"solid\"};addPropertyControls(CustomShareButton,{platform:{type:ControlType.Enum,options:[\"X\",\"Facebook\",\"LinkedIn\",\"Pinterest\",\"Whatsapp\",\"Telegram\",\"Reddit\",\"Hacker News\",\"Email\",\"Clipboard\"],defaultValue:\"X\"},iconImage:{type:ControlType.ResponsiveImage},iconAlt:{type:ControlType.String,defaultValue:\"X social share icon\"},iconWidth:{type:ControlType.Number,title:\"Width\",defaultValue:\"24\"},backgroundcolor:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#212121\"},radius:{type:ControlType.FusedNumber,title:\"Radius\",defaultValue:16,toggleKey:\"isMixed\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeft\",\"topRight\",\"bottomRight\",\"bottomLeft\"],valueLabels:[\"NW\",\"NE\",\"SE\",\"SW\"],min:0},padding:{type:ControlType.FusedNumber,title:\"Padding\",defaultValue:16,toggleKey:\"isMixed\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeft\",\"topRight\",\"bottomRight\",\"bottomLeft\"],valueLabels:[\"NW\",\"NE\",\"SE\",\"SW\"],min:0},borderproperties:{type:ControlType.Object,title:\"Border\",controls:{color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#222222\"},width:{type:ControlType.Number,title:\"Width\",defaultValue:0},style:{type:ControlType.Enum,title:\"Style\",options:[\"Solid\",\"Dashed\",\"Dotted\",\"Double\"],defaultValue:\"Solid\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomShareButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomShareButton.map"],"mappings":"yTAQG,SAAwB,EAA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