index.js
1 lines
| 1 | (()=>{"use strict";const e=window.wp.blocks,t=window.wp.blockEditor,l=window.wp.components,a=window.wp.i18n,o=window.wp.element,r=window.ReactJSXRuntime,i=({isPro:e,children:t})=>e?t:(0,r.jsxs)("div",{className:"pro-lock-wrapper",style:{position:"relative",cursor:"not-allowed"},children:[(0,r.jsx)("div",{style:{opacity:.4,pointerEvents:"none",filter:"grayscale(100%)"},children:t}),(0,r.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,r.jsx)(l.Tooltip,{text:"🔒 Pro Feature - Click to Upgrade",children:(0,r.jsx)("div",{style:{width:"100%",height:"100%"}})})})]}),s=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"awt/child-author-page-title","title":"Page Title Section (Child Author)","category":"author-website-templates","icon":"heading","description":"Page title/hero section for inner pages with heading, subheading, and decorative wave","keywords":["page","title","hero","heading","child-author"],"textdomain":"author-website-templates","editorScript":"file:./index.js","render":"file:./render.php","attributes":{"align":{"type":"string","default":"full"},"heading":{"type":"string","default":"So Nice to Meet You!"},"subHeading":{"type":"string","default":"I\'m Danielle Steel, a writer of silly stories and a lover of big adventures."},"sectionBgColor":{"type":"string","default":"rgba(0, 198, 255, 0.1)"},"curveColor":{"type":"string","default":"#FFFDF5"},"headingColor":{"type":"string","default":""},"textColor":{"type":"string","default":""},"blockId":{"type":"string","default":""},"titleStyle":{"type":"string","default":"fun"},"badgeText":{"type":"string","default":"Biography"}},"supports":{"html":false,"align":["full"]},"style":"file:./index.css"}');(0,e.registerBlockType)(s.name,{...s,edit:function({attributes:e,setAttributes:s,clientId:n}){const{heading:d,subHeading:h,sectionBgColor:u,curveColor:g,headingColor:p,textColor:c,blockId:x,titleStyle:b,badgeText:w}=e,m=window.awtVars?.isPro||!1;(0,o.useEffect)(()=>{x||s({blockId:n})},[x,n,s]);let f="text-5xl md:text-7xl mb-4";"elegant"===b?(f="text-5xl md:text-7xl font-serif font-bold mb-6",p||(f+=" text-brand-dark")):"author-pro"===b?(f="text-4xl md:text-5xl lg:text-6xl font-serif font-bold mb-6 leading-tight",p||(f+=" text-primary")):(f="text-5xl md:text-7xl font-black mb-4",p||(f+=" text-navy"));let v,y="text-xl mx-auto";"elegant"===b?(y="text-xl max-w-2xl mx-auto font-light leading-relaxed",c||(y+=" text-brand-gray")):"author-pro"===b?(y="text-lg leading-relaxed max-w-2xl mx-auto",c||(y+=" text-secondary")):(y="text-xl max-w-lg mx-auto",c||(y+=" text-navy/80")),v="elegant"===b?"#f8fafc":"author-pro"===b?"":"rgba(0, 198, 255, 0.1)";let _=`alignfull block-${x} relative overflow-hidden pt-20 pb-28`;"author-pro"===b&&(_=`alignfull block-${x} relative pt-32 pb-20 bg-paper border-b border-gray-100 overflow-hidden`);const C=(0,t.useBlockProps)({className:_,style:{backgroundColor:u||v}});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.InspectorControls,{children:[(0,r.jsxs)(l.PanelBody,{title:(0,a.__)("Style Settings","author-website-templates"),initialOpen:!0,children:[(0,r.jsx)(l.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"},{label:(0,a.__)("Author Pro","author-website-templates"),value:"author-pro"}],onChange:e=>s({titleStyle:e})}),("elegant"===b||"author-pro"===b)&&(0,r.jsx)(l.TextControl,{label:(0,a.__)("Badge Text","author-website-templates"),value:w,onChange:e=>s({badgeText:e})})]}),(0,r.jsxs)(l.PanelBody,{title:(0,a.__)("Content Settings","author-website-templates"),initialOpen:!1,children:[(0,r.jsx)(l.TextControl,{label:(0,a.__)("Heading","author-website-templates"),value:d,onChange:e=>s({heading:e}),help:(0,a.__)("You can also edit directly on the canvas","author-website-templates")}),(0,r.jsx)(l.TextareaControl,{label:(0,a.__)("Subheading","author-website-templates"),value:h,onChange:e=>s({subHeading:e}),rows:3,help:(0,a.__)("You can also edit directly on the canvas","author-website-templates")})]}),(0,r.jsxs)(l.PanelBody,{title:(0,a.__)("Design Settings","author-website-templates"),initialOpen:!1,children:[!m&&(0,r.jsx)(l.Notice,{status:"warning",isDismissible:!1,children:(0,a.__)("🔒 Upgrade to Pro to unlock styling controls","author-website-templates")}),(0,r.jsx)(i,{isPro:m,children:(0,r.jsx)(t.PanelColorSettings,{title:(0,a.__)("Colors","author-website-templates"),colorSettings:[{value:u,onChange:e=>s({sectionBgColor:e}),label:(0,a.__)("Background Color","author-website-templates")},{value:g,onChange:e=>s({curveColor:e}),label:(0,a.__)("Bottom Wave Color","author-website-templates")},{value:p,onChange:e=>s({headingColor:e}),label:(0,a.__)("Heading Color","author-website-templates")},{value:c,onChange:e=>s({textColor:e}),label:(0,a.__)("Subheading Color","author-website-templates")}]})})]})]}),(0,r.jsxs)("section",{...C,children:["elegant"!==b&&"author-pro"!==b&&(0,r.jsx)("div",{className:"absolute bottom-0 left-0 w-full",children:(0,r.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,r.jsx)("path",{d:"M0 100H1440V0C1192.5 49.497 919.5 74.497 720 74.497C520.5 74.497 247.5 49.497 0 0V100Z",fill:g||"#FFFDF5"})})}),(0,r.jsxs)("div",{className:"awt-container mx-auto px-6 relative z-10 text-center "+("author-pro"===b?"max-w-4xl":""),children:["elegant"===b&&(0,r.jsx)(t.RichText,{tagName:"span",className:"font-bold text-gray-500 uppercase tracking-widest text-xs mb-4 block",value:w,onChange:e=>s({badgeText:e}),placeholder:(0,a.__)("BIOGRAPHY","author-website-templates")}),(0,r.jsx)(t.RichText,{tagName:"h1",className:f,value:d,onChange:e=>s({heading:e}),placeholder:(0,a.__)("Enter page title...","author-website-templates"),style:{color:p||void 0}}),(0,r.jsx)(t.RichText,{tagName:"p",className:y,value:h,onChange:e=>s({subHeading:e}),placeholder:(0,a.__)("Enter subheading...","author-website-templates"),style:{color:c||void 0}})]})]})]})},save:function(){return null}})})(); |