{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/g0kfizZAq8ytR6ZMdmKP/C9CK6RWPU27jxVwczTKF/download_button.js"],
  "sourcesContent": ["/*\n * Noah Joshua\n * Copyright: \u00A9 2023, Studio SK. All rights reserved.\n * Created on: December 9, 2023\n * Contact Information: noah@studiosk.co\n *\n * License: ???\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Define the DownloadButton component with props being passed in\nexport default function DownloadButton(props){// Destructure props for easy access\nconst{text,padding,style,font,file,fileName}=props;//Fallback - extract filename from Url\nconst getFileNameFromUrl=url=>{const decodedUrl=decodeURIComponent(url);const parts=decodedUrl.split(\"/\");return parts[parts.length-1];};//Triggered on tap. Downloads the file with specific filename\nconst downloadFile=()=>{fetch(file).then(response=>response.blob()).then(blob=>{const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=fileName||getFileNameFromUrl(file)||\"download\"//If file name is not supplied, fallback on filename extracted from url\n;document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url);}).catch(error=>{console.error(\"Error downloading the file:\",error);});};// Return the JSX for the DownloadButton component\nreturn /*#__PURE__*/_jsx(motion.div,{onTap:downloadFile,style:{borderRadius:style.border.radius,backgroundColor:style.color,color:font.color,fontSize:font.size+\"px\",border:`${style.border.thickness}px ${style.border.color} solid`,padding:`${padding.vertical}px ${padding.horizontal}px`,cursor:\"pointer\",fontFamily:font.family,fontWeight:font.weight,display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},whileHover:{backgroundColor:style.hoverColor},children:text});}// Add property controls to the DownloadButton component.\naddPropertyControls(DownloadButton,{// Button Text\ntext:{title:\"Text\",type:ControlType.String,defaultValue:\"Download\"},// Padding properties group\npadding:{title:\"Padding\",type:ControlType.Object,controls:{horizontal:{type:ControlType.Number,defaultValue:20,unit:\"px\"},vertical:{type:ControlType.Number,defaultValue:12,unit:\"px\"}}},// Style properties group\nstyle:{title:\"Style\",type:ControlType.Object,controls:{color:{type:ControlType.Color,defaultValue:\"#EEF2F1\"},hoverColor:{type:ControlType.Color,defaultValue:\"rgba(218, 242, 221, 1)\"},border:{title:\"Border\",type:ControlType.Object,controls:{thickness:{type:ControlType.Number,defaultValue:1,unit:\"px\"},color:{type:ControlType.Color,defaultValue:\"#3B7F46\"},radius:{type:ControlType.Number,defaultValue:8}}}}},// Font properties group\nfont:{title:\"Font\",type:ControlType.Object,controls:{family:{type:ControlType.String,defaultValue:\"Inter\"},size:{type:ControlType.Number,defaultValue:18,unit:\"px\"},weight:{type:ControlType.Number,defaultValue:600,unit:\"w\",min:100,max:900,step:100},color:{type:ControlType.Color,defaultValue:\"#3B7F46\"}}},// File properties group\nfile:{title:\"File\",type:ControlType.File,allowedFileTypes:[],description:\"The file that will be downloaded\"},fileName:{type:ControlType.String,defaultValue:\"my_presentation\",description:\"The name of the file as it should appear when downloaded\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DownloadButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./download_button.map"],
  "mappings": "qJAAAA,IAQe,SAARC,EAAgCC,EAAM,CAC7C,GAAK,CAAC,KAAAC,EAAK,QAAAC,EAAQ,MAAAC,EAAM,KAAAC,EAAK,KAAAC,EAAK,SAAAC,CAAQ,EAAEN,EACvCO,EAAmBC,GAAK,CAA0C,IAAMC,EAA9B,mBAAmBD,CAAG,EAAyB,MAAM,GAAG,EAAE,OAAOC,EAAMA,EAAM,OAAO,CAAC,CAAE,EACjIC,EAAa,IAAI,CAAC,MAAML,CAAI,EAAE,KAAKM,GAAUA,EAAS,KAAK,CAAC,EAAE,KAAKC,GAAM,CAAC,IAAMJ,EAAI,OAAO,IAAI,gBAAgBI,CAAI,EAAQC,EAAK,SAAS,cAAc,GAAG,EAAEA,EAAK,KAAKL,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EAAE,MAAM,CAAC,KAAKA,EAAY,MAAM,aAAa,SAAS,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EACrZ,KAAK,CAAC,MAAM,OAAO,KAAKA,EAAY,OAAO,SAAS,CAAC,OAAO,CAAC,KAAKA,EAAY,OAAO,aAAa,OAAO,EAAE,KAAK,CAAC,KAAKA,EAAY,OAAO,aAAa,GAAG,KAAK,IAAI,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,aAAa,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,GAAG,EAAE,MAAM,CAAC,KAAKA,EAAY,MAAM,aAAa,SAAS,CAAC,CAAC,EAC9S,KAAK,CAAC,MAAM,OAAO,KAAKA,EAAY,KAAK,iBAAiB,CAAC,EAAE,YAAY,kCAAkC,EAAE,SAAS,CAAC,KAAKA,EAAY,OAAO,aAAa,kBAAkB,YAAY,0DAA0D,CAAC,CAAC",
  "names": ["init_ssg_sandbox_shims", "DownloadButton", "props", "text", "padding", "style", "font", "file", "fileName", "getFileNameFromUrl", "url", "parts", "downloadFile", "response", "blob", "link", "error", "p", "motion", "addPropertyControls", "ControlType"]
}
