index.js
1 lines
| 1 | (()=>{"use strict";const e=window.wp.blocks,t=window.wp.blockEditor,o=window.wp.components,a=window.wp.i18n,r=window.wp.element,l=window.ReactJSXRuntime,n=({isPro:e,children:t})=>e?t:(0,l.jsxs)("div",{className:"pro-lock-wrapper",style:{position:"relative",cursor:"not-allowed"},children:[(0,l.jsx)("div",{style:{opacity:.4,pointerEvents:"none",filter:"grayscale(100%)"},children:t}),(0,l.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,l.jsx)(o.Tooltip,{text:"🔒 Pro Feature - Click to Upgrade",children:(0,l.jsx)("div",{style:{width:"100%",height:"100%"}})})})]}),s=[["core/paragraph",{content:"That's me! I've been writing stories since I was your age. I love creating characters who go on big adventures and learn important lessons about friendship and bravery."}],["core/paragraph",{content:"When I'm not writing books about magical worlds and talking animals, you can find me reading, baking cookies, or playing with my dog, Max!"}]],i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"awt/child-author-about","version":"1.0.0","title":"About Author (Child Author)","category":"theme","icon":"admin-users","description":"About author section with bio, image, and Smart Pro Locking for styling controls.","keywords":["about","author","profile","child-author"],"textdomain":"author-website-templates","editorScript":"file:./index.js","attributes":{"align":{"type":"string","default":"full"},"heading":{"type":"string","default":"Who\'s This Person?"},"authorImageId":{"type":"number","default":0},"authorImageUrl":{"type":"string","default":"https://via.placeholder.com/400x500?text=Author+Photo"},"buttonText":{"type":"string","default":"Say Hello"},"buttonUrl":{"type":"string","default":"#contact"},"sectionBgColor":{"type":"string","default":""},"sectionPadding":{"type":"number","default":null},"headingColor":{"type":"string","default":""},"textColor":{"type":"string","default":""},"btnBgColor":{"type":"string","default":""},"btnTextColor":{"type":"string","default":""},"btnHoverBgColor":{"type":"string","default":""},"btnHoverTextColor":{"type":"string","default":""},"imageStyle":{"type":"string","default":"circle"},"showButton":{"type":"boolean","default":true},"blockId":{"type":"string","default":""},"aboutStyle":{"type":"string","default":"fun"}},"supports":{"html":false,"align":["full"]},"style":"file:./index.css"}');(0,e.registerBlockType)(i.name,{...i,edit:function({attributes:e,setAttributes:i,clientId:d}){const{heading:c,authorImageId:u,authorImageUrl:g,buttonText:h,buttonUrl:m,sectionBgColor:b,sectionPadding:p,headingColor:x,textColor:w,btnBgColor:y,btnTextColor:v,btnHoverBgColor:f,btnHoverTextColor:C,imageStyle:_,showButton:j,blockId:k,aboutStyle:B}=e,T=window.awtVars?.isPro||!1;(0,r.useEffect)(()=>{k||i({blockId:d})},[k,d,i]);const I="elegant"===B,S=I?"grid md:grid-cols-5 gap-16 items-center":"grid md:grid-cols-2 gap-12 items-center",N=I?"md:col-span-2 flex justify-center order-2 md:order-1":"order-2 md:order-1",P=I?"md:col-span-3 order-1 md:order-2":"order-1 md:order-2",$=b||null!==p?"":I?"bg-gray-50":"bg-yellow-sun/20 py-24",U=I?"text-4xl font-serif font-bold text-brand-dark mb-6":"text-4xl font-black text-navy mb-6",A=w?I?"text-lg space-y-4 leading-relaxed":"text-lg mb-4 leading-relaxed":I?"text-lg text-brand-gray space-y-4 leading-relaxed":"text-lg text-navy/80 mb-4 leading-relaxed";let H;H=I?"portrait"===_?"rounded-lg shadow-xl aspect-[4/5] object-cover w-full max-w-sm border border-gray-100":"rounded-full overflow-hidden w-64 h-64 md:w-80 md:h-80 shadow-lg border-4 border-white object-cover":"portrait"===_?"rounded-lg shadow-xl aspect-[4/5] object-cover w-full max-w-sm transform -rotate-2 hover:rotate-2 transition-transform duration-300":"rounded-full shadow-xl aspect-square object-cover w-full max-w-sm";const R=y?I?"px-8 py-3 rounded font-medium border border-gray-800 text-gray-900 transition-colors inline-block":"btn-fun btn-white":I?"px-8 py-3 rounded font-medium bg-white border border-gray-800 text-gray-900 hover:bg-gray-50 transition-colors inline-block":"btn-fun btn-white",D=`\n .block-${k} .btn-about:hover {\n ${f?`background-color: ${f} !important;`:""}\n ${C?`color: ${C} !important;`:""}\n }\n `,E=(0,t.useBlockProps)({className:`alignfull block-${k} awt-child-author-about ${$}`,style:{backgroundColor:b||void 0,paddingTop:null!==p?`${p}px`:void 0,paddingBottom:null!==p?`${p}px`:void 0}}),F=(0,t.useInnerBlocksProps)({className:`about-bio-content ${A}`},{allowedBlocks:["core/paragraph","core/heading","core/list"],template:s}),M=e=>{i({authorImageId:e.id,authorImageUrl:e.url})};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(t.InspectorControls,{children:[(0,l.jsxs)(o.PanelBody,{title:(0,a.__)("Content Settings","author-website-templates"),initialOpen:!0,children:[(0,l.jsx)(o.SelectControl,{label:(0,a.__)("Block Style","author-website-templates"),value:B,options:[{label:(0,a.__)("Fun (Child)","author-website-templates"),value:"fun"},{label:(0,a.__)("Elegant (Author)","author-website-templates"),value:"elegant"}],onChange:e=>i({aboutStyle:e})}),(0,l.jsx)(o.TextControl,{label:(0,a.__)("Heading","author-website-templates"),value:c,onChange:e=>i({heading:e}),help:(0,a.__)("You can also edit directly on the canvas","author-website-templates")}),(0,l.jsxs)("div",{className:"sidebar-image-control",style:{marginBottom:"16px"},children:[(0,l.jsx)("p",{style:{marginBottom:"8px",fontWeight:"bold"},children:(0,a.__)("Author Image","author-website-templates")}),(0,l.jsx)(t.MediaUploadCheck,{children:(0,l.jsx)(t.MediaUpload,{onSelect:M,allowedTypes:["image"],value:u,render:({open:e})=>(0,l.jsx)(l.Fragment,{children:g?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("img",{src:g,alt:"Author Preview",style:{width:"100%",height:"auto",marginBottom:"10px",borderRadius:"8px"}}),(0,l.jsx)(o.Button,{variant:"secondary",onClick:e,style:{width:"100%",marginBottom:"8px"},children:(0,a.__)("Replace Image","author-website-templates")}),(0,l.jsx)(o.Button,{variant:"link",isDestructive:!0,onClick:()=>i({authorImageId:0,authorImageUrl:""}),children:(0,a.__)("Remove","author-website-templates")})]}):(0,l.jsx)(o.Button,{variant:"primary",onClick:e,style:{width:"100%"},children:(0,a.__)("Upload Image","author-website-templates")})})})})]}),(0,l.jsx)("hr",{style:{margin:"16px 0"}}),(0,l.jsx)("h4",{style:{marginBottom:"12px",fontWeight:"bold"},children:(0,a.__)("Button Settings","author-website-templates")}),(0,l.jsx)(o.TextControl,{label:(0,a.__)("Button Text","author-website-templates"),value:h,onChange:e=>i({buttonText:e})}),(0,l.jsx)(o.TextControl,{label:(0,a.__)("Button URL","author-website-templates"),value:m,onChange:e=>i({buttonUrl:e}),placeholder:"#contact"}),(0,l.jsx)("hr",{style:{margin:"16px 0"}}),(0,l.jsx)("h4",{style:{marginBottom:"12px",fontWeight:"bold"},children:(0,a.__)("Display Options","author-website-templates")}),(0,l.jsx)(o.SelectControl,{label:(0,a.__)("Image Style","author-website-templates"),value:_,options:[{label:(0,a.__)("Circle (Default)","author-website-templates"),value:"circle"},{label:(0,a.__)("Portrait (Rounded + Rotated)","author-website-templates"),value:"portrait"}],onChange:e=>i({imageStyle:e}),help:(0,a.__)("Choose image shape for different page layouts","author-website-templates")}),(0,l.jsx)(o.ToggleControl,{label:(0,a.__)("Show CTA Button","author-website-templates"),checked:j,onChange:e=>i({showButton:e}),help:(0,a.__)("Toggle button visibility for About Page variation","author-website-templates")})]}),(0,l.jsxs)(o.PanelBody,{title:(0,a.__)("Design Settings","author-website-templates"),initialOpen:!1,children:[!T&&(0,l.jsx)(o.Notice,{status:"warning",isDismissible:!1,children:(0,a.__)("🔒 Upgrade to Pro to unlock styling controls","author-website-templates")}),(0,l.jsx)(n,{isPro:T,children:(0,l.jsx)(t.PanelColorSettings,{title:(0,a.__)("Section Colors","author-website-templates"),colorSettings:[{value:b,onChange:T?e=>i({sectionBgColor:e}):void 0,label:(0,a.__)("Section Background","author-website-templates"),disableCustomColors:!T},{value:x,onChange:T?e=>i({headingColor:e}):void 0,label:(0,a.__)("Heading Color","author-website-templates"),disableCustomColors:!T},{value:w,onChange:T?e=>i({textColor:e}):void 0,label:(0,a.__)("Text Color","author-website-templates"),disableCustomColors:!T}]})}),(0,l.jsx)(n,{isPro:T,children:(0,l.jsx)(o.RangeControl,{label:(0,a.__)("Section Padding (px)","author-website-templates"),value:null!==p?p:96,onChange:T?e=>i({sectionPadding:e}):void 0,min:0,max:200,step:8,disabled:!T,help:T?(0,a.__)("Default: 96px (py-24)","author-website-templates"):(0,a.__)("Pro feature","author-website-templates")})}),(0,l.jsx)(n,{isPro:T,children:(0,l.jsx)(t.PanelColorSettings,{title:(0,a.__)("Button Colors","author-website-templates"),colorSettings:[{value:y,onChange:T?e=>i({btnBgColor:e}):void 0,label:(0,a.__)("Button Background","author-website-templates"),disableCustomColors:!T},{value:v,onChange:T?e=>i({btnTextColor:e}):void 0,label:(0,a.__)("Button Text","author-website-templates"),disableCustomColors:!T},{value:f,onChange:T?e=>i({btnHoverBgColor:e}):void 0,label:(0,a.__)("Button Hover Background","author-website-templates"),disableCustomColors:!T},{value:C,onChange:T?e=>i({btnHoverTextColor:e}):void 0,label:(0,a.__)("Button Hover Text","author-website-templates"),disableCustomColors:!T}]})})]})]}),(0,l.jsxs)("section",{...E,children:[(0,l.jsx)("style",{children:D}),(0,l.jsx)("div",{className:"awt-container mx-auto px-6",children:(0,l.jsxs)("div",{className:S,children:[(0,l.jsx)("div",{className:N,children:(0,l.jsx)(t.MediaUpload,{onSelect:M,allowedTypes:["image"],value:u,render:({open:e})=>(0,l.jsx)("figure",{className:"about-section-image-container",onClick:e,children:g?(0,l.jsx)("img",{src:g,alt:"Author photo",className:H}):(0,l.jsx)("div",{className:"bg-gray-200 aspect-[4/5] flex items-center justify-center",children:(0,l.jsx)(o.Button,{variant:"primary",onClick:e,children:(0,a.__)("Upload Author Image","author-website-templates")})})})})}),(0,l.jsxs)("div",{className:P,children:[(0,l.jsx)(t.RichText,{tagName:"h2",className:U,value:c,onChange:e=>i({heading:e}),placeholder:(0,a.__)("Enter heading...","author-website-templates"),style:{color:x||void 0}}),(0,l.jsx)("div",{...F,style:{color:w||void 0}}),j&&(0,l.jsx)("div",{className:"mt-8",children:(0,l.jsx)(t.RichText,{tagName:"span",value:h,onChange:e=>i({buttonText:e}),placeholder:(0,a.__)("Button text...","author-website-templates"),className:R,style:{backgroundColor:y||void 0,color:v||void 0,textDecoration:"none"}})})]})]})})]})]})},save:function({attributes:e}){const{heading:o,authorImageUrl:a,buttonText:r,buttonUrl:n,sectionBgColor:s,sectionPadding:i,headingColor:d,textColor:c,btnBgColor:u,btnTextColor:g,btnHoverBgColor:h,btnHoverTextColor:m,imageStyle:b,showButton:p,blockId:x,aboutStyle:w}=e,y="elegant"===w,v=y?"grid md:grid-cols-5 gap-16 items-center":"grid md:grid-cols-2 gap-12 items-center",f=y?"md:col-span-2 flex justify-center order-2 md:order-1":"order-2 md:order-1",C=y?"md:col-span-3 order-1 md:order-2":"order-1 md:order-2",_=s||null!==i?"":y?"bg-gray-50":"bg-yellow-sun/20 py-24",j=y?"text-4xl font-serif font-bold text-brand-dark mb-6":"text-4xl font-black text-navy mb-6",k=c?y?"text-lg space-y-4 leading-relaxed":"text-lg mb-4 leading-relaxed":y?"text-lg text-brand-gray space-y-4 leading-relaxed":"text-lg text-navy/80 mb-4 leading-relaxed";let B;B=y?"portrait"===b?"rounded-lg shadow-xl aspect-[4/5] object-cover w-full max-w-sm border border-gray-100":"rounded-full overflow-hidden w-64 h-64 md:w-80 md:h-80 shadow-lg border-4 border-white object-cover":"portrait"===b?"rounded-lg shadow-xl aspect-[4/5] object-cover w-full max-w-sm transform -rotate-2 hover:rotate-2 transition-transform duration-300":"rounded-full shadow-xl aspect-square object-cover w-full max-w-sm";const T=u?y?"px-8 py-3 rounded font-medium border border-gray-800 text-gray-900 transition-colors inline-block":"btn-fun btn-white":y?"px-8 py-3 rounded font-medium bg-white border border-gray-800 text-gray-900 hover:bg-gray-50 transition-colors inline-block":"btn-fun btn-white",I=`\n .block-${x} .btn-about:hover {\n ${h?`background-color: ${h} !important;`:""}\n ${m?`color: ${m} !important;`:""}\n }\n `,S=t.useBlockProps.save({className:`alignfull block-${x} awt-child-author-about ${_}`,style:{backgroundColor:s||void 0,paddingTop:null!==i?`${i}px`:void 0,paddingBottom:null!==i?`${i}px`:void 0}}),N=t.useInnerBlocksProps.save({className:`about-bio-content ${k}`});return(0,l.jsxs)("section",{...S,id:"about",children:[(h||m)&&(0,l.jsx)("style",{dangerouslySetInnerHTML:{__html:I}}),(0,l.jsx)("div",{className:"awt-container mx-auto px-6",children:(0,l.jsxs)("div",{className:v,children:[(0,l.jsx)("div",{className:f,children:(0,l.jsx)("figure",{className:"about-section-image-container",children:a&&(0,l.jsx)("img",{src:a,alt:"Author photo",className:B})})}),(0,l.jsxs)("div",{className:C,children:[(0,l.jsx)(t.RichText.Content,{tagName:"h2",className:j,value:o,style:{color:d||void 0}}),(0,l.jsx)("div",{...N,style:{color:c||void 0}}),p&&(0,l.jsx)("div",{className:"mt-8",children:(0,l.jsx)("a",{href:n,className:T,style:{backgroundColor:u||void 0,color:g||void 0,textDecoration:"none"},children:r})})]})]})})]})}})})(); |