index.js
1 lines
| 1 | (()=>{"use strict";const e=window.wp.blocks,t=window.wp.blockEditor,o=window.wp.components,l=window.wp.i18n,a=window.wp.element,s=window.ReactJSXRuntime,i=({isPro:e,children:t})=>e?t:(0,s.jsxs)("div",{className:"pro-lock-wrapper",style:{position:"relative",cursor:"not-allowed"},children:[(0,s.jsx)("div",{style:{opacity:.4,pointerEvents:"none",filter:"grayscale(100%)"},children:t}),(0,s.jsx)("a",{href:"https://rswpthemes.com/author-portfolio-pro-wordpress-theme/",target:"_blank",rel:"noopener noreferrer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10,cursor:"pointer"},"aria-label":"Upgrade to Pro",children:(0,s.jsx)(o.Tooltip,{text:"🔒 Pro Feature - Click to Upgrade",children:(0,s.jsx)("div",{style:{width:"100%",height:"100%"}})})})]}),n=[["awt/child-author-social-icon",{platform:"instagram",url:"https://instagram.com/yourusername"}],["awt/child-author-social-icon",{platform:"facebook",url:"https://facebook.com/yourusername"}],["awt/child-author-social-icon",{platform:"twitter",url:"https://twitter.com/yourusername"}]],r=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"awt/child-author-socials","title":"Social Connections (Child Author)","category":"author-website-templates","icon":"share","description":"Social media connections section with platform icons","keywords":["social","connections","links","icons","child-author"],"textdomain":"author-website-templates","editorScript":"file:./index.js","attributes":{"align":{"type":"string","default":"full"},"heading":{"type":"string","default":"Let\'s Be Friends!"},"description":{"type":"string","default":"Follow me on social media for updates, behind-the-scenes peeks, and all my latest adventures!"},"sectionBgColor":{"type":"string","default":""},"curveColor":{"type":"string","default":"#FFFDF5"},"headingColor":{"type":"string","default":""},"textColor":{"type":"string","default":""},"blockId":{"type":"string","default":""},"socialsStyle":{"type":"string","default":"fun"},"iconColor":{"type":"string","default":""},"hideCurve":{"type":"boolean","default":false},"sectionPadding":{"type":"number","default":null}},"providesContext":{"awt/socialsStyle":"socialsStyle","awt/iconColor":"iconColor"},"supports":{"html":false,"align":["full"]},"style":"file:./index.css"}');(0,e.registerBlockType)(r.name,{...r,edit:function({attributes:e,setAttributes:r,clientId:c}){const{heading:d,description:p,sectionBgColor:u,curveColor:x,headingColor:h,textColor:g,blockId:m,socialsStyle:w,iconColor:b,hideCurve:f,sectionPadding:v}=e,C=window.awtVars?.isPro||!1;(0,a.useEffect)(()=>{m||r({blockId:c})},[m,c,r]);const y="elegant"===w,_=u?"":y?"bg-[#f8fafc]":"bg-yellow-sun/20",j=y?"border-t border-gray-100":"",k=`${y?"text-3xl md:text-5xl font-serif font-bold text-center mb-6":"text-4xl md:text-5xl font-black text-center mb-4"} ${h?"":y?"text-slate-800":"text-navy"}`,N=`${y?"text-xl max-w-lg mx-auto text-center mb-10 font-light":"text-xl max-w-lg mx-auto text-center mb-10"} ${g?"":y?"text-slate-500":"text-navy/80"}`,S={backgroundColor:u||void 0,paddingTop:v?`${v}px`:y?"80px":"96px",paddingBottom:v?`${v}px`:y?"80px":"96px"},B=(0,t.useBlockProps)({className:`alignfull block-${m} relative ${_} ${j}`,style:S}),P=(0,t.useInnerBlocksProps)({className:"flex space-x-8 justify-center flex-wrap gap-y-4"},{allowedBlocks:["awt/child-author-social-icon"],template:n});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.InspectorControls,{children:[(0,s.jsx)(o.PanelBody,{title:(0,l.__)("Content Settings","author-website-templates"),initialOpen:!0,children:(0,s.jsx)(o.TextareaControl,{label:(0,l.__)("Description","author-website-templates"),value:p,onChange:e=>r({description:e}),rows:3,help:(0,l.__)("You can also edit directly on the canvas","author-website-templates")})}),(0,s.jsx)(o.PanelBody,{title:(0,l.__)("Styles","author-website-templates"),initialOpen:!0,children:(0,s.jsx)(o.SelectControl,{label:(0,l.__)("Block Style","author-website-templates"),value:w,options:[{label:(0,l.__)("Fun & Playful","author-website-templates"),value:"fun"},{label:(0,l.__)("Elegant & Minimal","author-website-templates"),value:"elegant"}],onChange:e=>r({socialsStyle:e})})}),(0,s.jsxs)(o.PanelBody,{title:(0,l.__)("Design Settings","author-website-templates"),initialOpen:!1,children:[!C&&(0,s.jsx)(o.Notice,{status:"warning",isDismissible:!1,children:(0,l.__)("🔒 Upgrade to Pro to unlock styling controls","author-website-templates")}),(0,s.jsxs)(i,{isPro:C,children:[(0,s.jsx)(o.ToggleControl,{label:(0,l.__)("Hide Top Curve","author-website-templates"),checked:f,onChange:e=>r({hideCurve:e})}),(0,s.jsx)(o.RangeControl,{label:(0,l.__)("Section Padding","author-website-templates"),value:v,onChange:e=>r({sectionPadding:e}),min:0,max:200}),(0,s.jsx)(t.PanelColorSettings,{title:(0,l.__)("Colors","author-website-templates"),colorSettings:[{value:u,onChange:e=>r({sectionBgColor:e}),label:(0,l.__)("Section Background","author-website-templates")},{value:x,onChange:e=>r({curveColor:e}),label:(0,l.__)("Top Wave Color","author-website-templates")},{value:h,onChange:e=>r({headingColor:e}),label:(0,l.__)("Heading Color","author-website-templates")},{value:g,onChange:e=>r({textColor:e}),label:(0,l.__)("Text Color","author-website-templates")},{value:b,onChange:e=>r({iconColor:e}),label:(0,l.__)("Global Icon Color","author-website-templates")}]})]})]})]}),(0,s.jsxs)("section",{...B,children:[!y&&!f&&(0,s.jsx)("div",{className:"absolute top-0 left-0 w-full",children:(0,s.jsx)("svg",{viewBox:"0 0 1440 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"none",className:"w-full h-auto",children:(0,s.jsx)("path",{d:"M0 0H1440V100C1192.5 50.503 919.5 25.503 720 25.503C520.5 25.503 247.5 50.503 0 100V0Z",fill:x||"#FFFDF5"})})}),(0,s.jsxs)("div",{className:"awt-container mx-auto px-6 relative z-10",children:[(0,s.jsx)(t.RichText,{tagName:"h2",className:k,value:d,onChange:e=>r({heading:e}),placeholder:(0,l.__)("Section heading...","author-website-templates"),style:{color:h||void 0}}),(0,s.jsx)(t.RichText,{tagName:"p",className:N,value:p,onChange:e=>r({description:e}),placeholder:(0,l.__)("Description...","author-website-templates"),style:{color:g||void 0}}),(0,s.jsx)("div",{...P})]})]})]})},save:function({attributes:e}){const{heading:o,description:l,sectionBgColor:a,curveColor:i,headingColor:n,textColor:r,blockId:c,socialsStyle:d,hideCurve:p,sectionPadding:u}=e,x="elegant"===d,h=a?"":x?"bg-[#f8fafc]":"bg-yellow-sun/20",g=x?"border-t border-gray-100":"",m=`${x?"text-3xl md:text-5xl font-serif font-bold text-center mb-6":"text-4xl md:text-5xl font-black text-center mb-4"} ${n?"":x?"text-slate-800":"text-navy"}`,w=`${x?"text-xl max-w-lg mx-auto text-center mb-10 font-light":"text-xl max-w-lg mx-auto text-center mb-10"} ${r?"":x?"text-slate-500":"text-navy/80"}`,b={backgroundColor:a||void 0,paddingTop:u?`${u}px`:x?"80px":"96px",paddingBottom:u?`${u}px`:x?"80px":"96px"},f=t.useBlockProps.save({className:`alignfull block-${c} relative ${h} ${g}`,style:b}),v=t.useInnerBlocksProps.save({className:"flex space-x-8 justify-center flex-wrap gap-y-4"});return(0,s.jsxs)("section",{...f,children:[!x&&!p&&(0,s.jsx)("div",{className:"absolute top-0 left-0 w-full",children:(0,s.jsx)("svg",{viewBox:"0 0 1440 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"none",className:"w-full h-auto",children:(0,s.jsx)("path",{d:"M0 0H1440V100C1192.5 50.503 919.5 25.503 720 25.503C520.5 25.503 247.5 50.503 0 100V0Z",fill:i||"#FFFDF5"})})}),(0,s.jsxs)("div",{className:"awt-container mx-auto px-6 relative z-10",children:[(0,s.jsx)(t.RichText.Content,{tagName:"h2",className:m,value:o,style:{color:n||void 0}}),(0,s.jsx)(t.RichText.Content,{tagName:"p",className:w,value:l,style:{color:r||void 0}}),(0,s.jsx)("div",{...v})]})]})}})})(); |