PluginProbe ʕ •ᴥ•ʔ
Author Website Templates – Create Writer, Author & Publisher Websites Easily / 1.1.9
Author Website Templates – Create Writer, Author & Publisher Websites Easily v1.1.9
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9
author-website-templates / build / blocks / child-author / contact / index.js
author-website-templates / build / blocks / child-author / contact Last commit date
block.json 1 month ago index.asset.php 1 month ago index.js 1 month ago
index.js
1 lines
1 (()=>{"use strict";const e=window.wp.blocks,t=window.wp.i18n,o=window.wp.blockEditor,l=window.wp.components,n=window.wp.element,a=window.ReactJSXRuntime,s=({isPro:e,children:t})=>e?t:(0,a.jsxs)("div",{className:"pro-lock-wrapper",style:{position:"relative",cursor:"not-allowed"},children:[(0,a.jsx)("div",{style:{opacity:.4,pointerEvents:"none",filter:"grayscale(100%)"},children:t}),(0,a.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,a.jsx)(l.Tooltip,{text:"🔒 Pro Feature - Click to Upgrade",children:(0,a.jsx)("div",{style:{width:"100%",height:"100%"}})})})]}),r=JSON.parse('{"apiVersion":3,"name":"awt/child-author-contact","version":"0.1.0","title":"Contact Section (Child Author)","category":"awt-blocks","icon":"email","description":"A contact section with a form or shortcode support.","keywords":["contact","form","message","email"],"supports":{"html":false,"align":["full"]},"textdomain":"author-website-templates","attributes":{"align":{"type":"string","default":"full"},"blockId":{"type":"string"},"heading":{"type":"string","default":"Get in Touch!"},"description":{"type":"string","default":"Do you have a question, a note, or a fun idea for a school visit? I love hearing from readers! Send me a message, and I\'ll get back to you as soon as I can."},"buttonText":{"type":"string","default":"Send Your Message!"},"formShortcode":{"type":"string","default":""},"sectionBgColor":{"type":"string"},"textColor":{"type":"string"},"buttonBgColor":{"type":"string"},"buttonTextColor":{"type":"string"},"sectionPadding":{"type":"number","default":96}},"editorScript":"file:./index.js","style":"file:./index.css"}');(0,e.registerBlockType)(r.name,{...r,edit:function({attributes:e,setAttributes:r,clientId:i}){const{blockId:c,heading:d,description:u,buttonText:h,formShortcode:m,sectionBgColor:p,textColor:b,buttonBgColor:x,buttonTextColor:g,sectionPadding:y}=e,f=window.awtVars?.isPro||!1;(0,n.useEffect)(()=>{c||r({blockId:i})},[i,c,r]);const w=p?"":"bg-white",j=(0,o.useBlockProps)({className:`alignfull block-${c} awt-child-author-contact ${w}`,style:{backgroundColor:p||void 0,paddingTop:null!==y?`${y}px`:void 0,paddingBottom:null!==y?`${y}px`:void 0}}),v={color:b||void 0},C={color:b||void 0},N={backgroundColor:x||void 0,color:g||void 0,borderColor:x||void 0},k=x?"btn-fun":"btn-fun bg-yellow-sun",_=b?"":"text-navy";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.InspectorControls,{children:(0,a.jsx)(l.PanelBody,{title:(0,t.__)("Form Settings","author-website-templates"),children:(0,a.jsx)(l.TextControl,{label:(0,t.__)("Form Shortcode","author-website-templates"),value:m,onChange:e=>r({formShortcode:e}),help:(0,t.__)("Enter a shortcode (e.g. [contact-form-7 ...]) to replace the default form.","author-website-templates")})})}),(0,a.jsxs)(o.InspectorControls,{group:"styles",children:[(0,a.jsx)(l.PanelBody,{title:(0,t.__)("Dimensions","author-website-templates"),initialOpen:!0,children:(0,a.jsx)(s,{isPro:f,children:(0,a.jsx)(l.RangeControl,{label:(0,t.__)("Section Padding (px)","author-website-templates"),value:null!==y?y:96,onChange:e=>r({sectionPadding:e}),min:0,max:200,help:f?(0,t.__)("Default: 96px (py-24)","author-website-templates"):(0,t.__)("Pro feature","author-website-templates")})})}),(0,a.jsx)(o.PanelColorSettings,{title:(0,t.__)("Unused Title","author-website-templates"),initialOpen:!0,colorSettings:[]})]}),(0,a.jsxs)(o.InspectorControls,{group:"styles",children:[!f&&(0,a.jsx)(l.PanelBody,{children:(0,a.jsx)(l.Notice,{status:"warning",isDismissible:!1,children:(0,t.__)("🔒 Upgrade to Pro to unlock styling controls","author-website-templates")})}),(0,a.jsxs)(s,{isPro:f,children:[(0,a.jsx)(l.PanelBody,{title:(0,t.__)("Dimensions","author-website-templates"),children:(0,a.jsx)(l.RangeControl,{label:(0,t.__)("Section Padding (px)","author-website-templates"),value:null!==y?y:96,onChange:e=>r({sectionPadding:e}),min:0,max:200})}),(0,a.jsx)(o.PanelColorSettings,{title:(0,t.__)("Colors","author-website-templates"),initialOpen:!0,colorSettings:[{value:p,onChange:e=>r({sectionBgColor:e}),label:(0,t.__)("Section Background","author-website-templates")},{value:b,onChange:e=>r({textColor:e}),label:(0,t.__)("Text Color","author-website-templates")},{value:x,onChange:e=>r({buttonBgColor:e}),label:(0,t.__)("Button Background","author-website-templates")},{value:g,onChange:e=>r({buttonTextColor:e}),label:(0,t.__)("Button Text Color","author-website-templates")}]})]})]}),(0,a.jsx)("section",{...j,children:(0,a.jsxs)("div",{className:"awt-container container mx-auto px-6",children:[(0,a.jsx)(o.RichText,{tagName:"h2",className:"section-heading",value:d,onChange:e=>r({heading:e}),placeholder:(0,t.__)("Heading...","author-website-templates"),style:v}),(0,a.jsx)(o.RichText,{tagName:"p",className:`text-lg ${_}/80 text-center max-w-2xl mx-auto mb-12`,value:u,onChange:e=>r({description:e}),placeholder:(0,t.__)("Description...","author-website-templates"),style:{...C,opacity:.8}}),m?(0,a.jsx)("div",{className:"flex items-center justify-center p-12 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50 text-gray-500",children:(0,a.jsxs)("p",{children:["📧 ",(0,t.__)("Shortcode Form will be rendered here:","author-website-templates")," ",(0,a.jsx)("strong",{children:m})]})}):(0,a.jsxs)("form",{className:"max-w-3xl mx-auto pointer-events-none",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:`block mb-2 font-bold ${_}`,style:C,children:"Your Name"}),(0,a.jsx)("input",{type:"text",placeholder:"Like 'Leo the Lion'",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy placeholder:text-navy/50 focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all",readOnly:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:`block mb-2 font-bold ${_}`,style:C,children:"Your Email"}),(0,a.jsx)("input",{type:"email",placeholder:"your-email@example.com",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy placeholder:text-navy/50 focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all",readOnly:!0})]})]}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("label",{className:`block mb-2 font-bold ${_}`,style:C,children:"What's this about?"}),(0,a.jsxs)("select",{className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all appearance-none",readOnly:!0,children:[(0,a.jsx)("option",{children:"A School Visit"}),(0,a.jsx)("option",{children:"A Question About a Book"}),(0,a.jsx)("option",{children:"Sharing a Drawing!"})]})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("label",{className:`block mb-2 font-bold ${_}`,style:C,children:"Your Message"}),(0,a.jsx)("textarea",{rows:"6",placeholder:"Tell me all about it...",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy placeholder:text-navy/50 focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all",readOnly:!0})]}),(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("div",{className:`inline-block px-8 py-3 rounded-full font-extrabold font-sans uppercase tracking-wide text-navy shadow-lg transition-all duration-300 ease-in-out ${k}`,style:N,children:(0,a.jsx)(o.RichText,{value:h,onChange:e=>r({buttonText:e}),placeholder:(0,t.__)("Button Text...","author-website-templates"),tagName:"span"})})})]})]})})]})},save:function({attributes:e}){const{blockId:t,heading:l,description:n,buttonText:s,formShortcode:r,sectionBgColor:i,textColor:c,buttonBgColor:d,buttonTextColor:u,sectionPadding:h}=e,m=i?"":"bg-white",p=c?"":"text-navy",b=d?"btn-fun":"btn-fun bg-yellow-sun",x=o.useBlockProps.save({className:`alignfull block-${t} awt-child-author-contact ${m}`,style:{backgroundColor:i||void 0,paddingTop:null!==h?`${h}px`:void 0,paddingBottom:null!==h?`${h}px`:void 0}}),g={color:c||void 0},y={color:c||void 0},f={backgroundColor:d||void 0,color:u||void 0,borderColor:d||void 0};return(0,a.jsx)("section",{...x,children:(0,a.jsxs)("div",{className:"awt-container container mx-auto px-6",children:[(0,a.jsx)(o.RichText.Content,{tagName:"h2",className:"section-heading",value:l,style:g}),(0,a.jsx)(o.RichText.Content,{tagName:"p",className:`text-lg ${p}/80 text-center max-w-2xl mx-auto mb-12`,value:n,style:{...y,opacity:.8}}),r?(0,a.jsx)("div",{className:"awt-contact-shortcode-wrapper",children:r}):(0,a.jsxs)("form",{action:"#",method:"POST",className:"max-w-3xl mx-auto",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"name",className:`block mb-2 font-bold ${p}`,style:y,children:"Your Name"}),(0,a.jsx)("input",{type:"text",id:"name",name:"name",placeholder:"Like 'Leo the Lion'",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy placeholder:text-navy/50 focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"email-contact",className:`block mb-2 font-bold ${p}`,style:y,children:"Your Email"}),(0,a.jsx)("input",{type:"email",id:"email-contact",name:"email",placeholder:"your-email@example.com",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy placeholder:text-navy/50 focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all",required:!0})]})]}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("label",{htmlFor:"subject",className:`block mb-2 font-bold ${p}`,style:y,children:"What's this about?"}),(0,a.jsxs)("select",{id:"subject",name:"subject",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all appearance-none",children:[(0,a.jsx)("option",{children:"A School Visit"}),(0,a.jsx)("option",{children:"A Question About a Book"}),(0,a.jsx)("option",{children:"Sharing a Drawing!"}),(0,a.jsx)("option",{children:"Just Saying Hello!"})]})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("label",{htmlFor:"message",className:`block mb-2 font-bold ${p}`,style:y,children:"Your Message"}),(0,a.jsx)("textarea",{id:"message",name:"message",rows:"6",placeholder:"Tell me all about it...",className:"w-full p-4 rounded-lg bg-cream border-2 border-transparent text-navy placeholder:text-navy/50 focus:outline-none focus:ring-2 focus:ring-blue-sky transition-all"})]}),(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("button",{type:"submit",className:`px-8 py-3 rounded-full font-extrabold font-sans uppercase tracking-wide text-navy shadow-lg transition-all duration-300 ease-in-out ${b}`,style:f,children:(0,a.jsx)(o.RichText.Content,{value:s})})})]})]})})}})})();