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 / gallery / index.js
author-website-templates / build / blocks / child-author / gallery 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.blockEditor,l=window.wp.components,o=window.wp.i18n,a=window.wp.element,s=window.ReactJSXRuntime,r=({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)(l.Tooltip,{text:"🔒 Pro Feature - Click to Upgrade",children:(0,s.jsx)("div",{style:{width:"100%",height:"100%"}})})})]}),i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"awt/child-author-gallery","title":"Photo Gallery (Child Author)","category":"author-website-templates","icon":"format-gallery","description":"Photo gallery grid with bulk upload and playful hover effects","keywords":["gallery","photos","images","grid","child-author"],"textdomain":"author-website-templates","editorScript":"file:./index.js","attributes":{"align":{"type":"string","default":"full"},"heading":{"type":"string","default":"My Adventures"},"images":{"type":"array","default":[]},"columns":{"type":"number","default":4},"sectionBgColor":{"type":"string","default":""},"headingColor":{"type":"string","default":""},"blockId":{"type":"string","default":""}},"supports":{"html":false,"align":["full"]},"style":"file:./index.css"}');(0,e.registerBlockType)(i.name,{...i,edit:function({attributes:e,setAttributes:i,clientId:n}){const{heading:d,images:c,columns:h,sectionBgColor:p,headingColor:u,blockId:g}=e,m=window.awtVars?.isPro||!1;(0,a.useEffect)(()=>{g||i({blockId:n})},[g,n,i]);const x=u?"text-4xl md:text-5xl font-black text-center mb-12":"text-4xl md:text-5xl font-black text-navy text-center mb-12",w=(0,t.useBlockProps)({className:`alignfull block-${g} py-24`,style:{backgroundColor:p||void 0}}),b=e=>{const t=e.map(e=>({id:e.id,url:e.url,alt:e.alt||""}));i({images:t})},y=`grid grid-cols-2 md:grid-cols-${h} gap-4 md:gap-6`;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.InspectorControls,{children:[(0,s.jsxs)(l.PanelBody,{title:(0,o.__)("Content Settings","author-website-templates"),initialOpen:!0,children:[(0,s.jsx)(t.RichText,{tagName:"div",value:d,onChange:e=>i({heading:e}),placeholder:(0,o.__)("Gallery heading...","author-website-templates"),style:{marginBottom:"16px"}}),(0,s.jsx)(l.RangeControl,{label:(0,o.__)("Columns (Desktop)","author-website-templates"),value:h,onChange:e=>i({columns:e}),min:2,max:6,step:1,help:(0,o.__)("Number of columns on desktop screens","author-website-templates")}),c.length>0&&(0,s.jsx)(t.MediaUploadCheck,{children:(0,s.jsx)(t.MediaUpload,{onSelect:b,allowedTypes:["image"],value:c.map(e=>e.id),multiple:!0,gallery:!0,render:({open:e})=>(0,s.jsx)(l.Button,{variant:"secondary",onClick:e,style:{width:"100%",marginTop:"8px"},children:(0,o.__)("Edit Gallery","author-website-templates")})})})]}),(0,s.jsxs)(l.PanelBody,{title:(0,o.__)("Design Settings","author-website-templates"),initialOpen:!1,children:[!m&&(0,s.jsx)(l.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("🔒 Upgrade to Pro to unlock styling controls","author-website-templates")}),(0,s.jsx)(r,{isPro:m,children:(0,s.jsx)(t.PanelColorSettings,{title:(0,o.__)("Colors","author-website-templates"),colorSettings:[{value:p,onChange:e=>i({sectionBgColor:e}),label:(0,o.__)("Section Background","author-website-templates")},{value:u,onChange:e=>i({headingColor:e}),label:(0,o.__)("Heading Color","author-website-templates")}]})})]})]}),(0,s.jsx)("section",{...w,children:(0,s.jsxs)("div",{className:"awt-container mx-auto px-6",children:[(0,s.jsx)(t.RichText,{tagName:"h2",className:x,value:d,onChange:e=>i({heading:e}),placeholder:(0,o.__)("Gallery heading...","author-website-templates"),style:{color:u||void 0}}),0===c.length?(0,s.jsx)("div",{className:"text-center py-20 bg-gray-100 rounded-lg",children:(0,s.jsx)(t.MediaUploadCheck,{children:(0,s.jsx)(t.MediaUpload,{onSelect:b,allowedTypes:["image"],value:c.map(e=>e.id),multiple:!0,gallery:!0,render:({open:e})=>(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-gray-500 mb-4",children:(0,o.__)("No photos yet","author-website-templates")}),(0,s.jsx)(l.Button,{variant:"primary",onClick:e,size:"large",children:(0,o.__)("📸 Upload Photos","author-website-templates")})]})})})}):(0,s.jsx)("div",{className:y,children:c.map((e,t)=>{const l=t%2==0?"hover:rotate-2":"hover:-rotate-2";return(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-lg shadow-lg group",children:[(0,s.jsx)("img",{src:e.url,alt:e.alt,className:`w-full h-full aspect-square object-cover transition-all duration-300 hover:shadow-2xl hover:scale-105 ${l}`}),(0,s.jsx)("button",{onClick:()=>(e=>{const t=c.filter((t,l)=>l!==e);i({images:t})})(t),className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-8 h-8 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity","aria-label":(0,o.__)("Remove image","author-website-templates"),children:"×"})]},e.id||t)})})]})})]})},save:function({attributes:e}){const{heading:l,images:o,columns:a,sectionBgColor:r,headingColor:i,blockId:n}=e,d=i?"text-4xl md:text-5xl font-black text-center mb-12":"text-4xl md:text-5xl font-black text-navy text-center mb-12",c=`grid grid-cols-2 md:grid-cols-${a} gap-4 md:gap-6`,h=t.useBlockProps.save({className:`alignfull block-${n} py-24`,style:{backgroundColor:r||void 0}});return(0,s.jsx)("section",{...h,children:(0,s.jsxs)("div",{className:"awt-container mx-auto px-6",children:[(0,s.jsx)(t.RichText.Content,{tagName:"h2",className:d,value:l,style:{color:i||void 0}}),o&&o.length>0&&(0,s.jsx)("div",{className:c,children:o.map((e,t)=>{const l=t%2==0?"hover:rotate-2":"hover:-rotate-2";return(0,s.jsx)("div",{className:"overflow-hidden rounded-lg shadow-lg",children:(0,s.jsx)("img",{src:e.url,alt:e.alt,className:`w-full h-full aspect-square object-cover transition-all duration-300 hover:shadow-2xl hover:scale-105 ${l}`})},e.id||t)})})]})})}})})();