// item-component.js // Reusable item component: image on left, three text areas on right. const _ensureStyles = (() => { if (document.getElementById('item-component-styles')) return true; const style = document.createElement('style'); style.id = 'item-component-styles'; style.textContent = ` /* Grid wrapper for multiple item components */ .item-component-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;align-items:start} .item-component{display:flex;align-items:flex-start;gap:12px;font-family:inherit;padding:10px;border:1px solid #e6e6e6;border-radius:8px;background:#fff} .item-component__img{flex:0 0 auto} .item-component__img img{display:block;width:72px;height:72px;object-fit:cover;border-radius:6px} .item-component__content{flex:1;display:flex;flex-direction:column;gap:6px} .item-component__line{margin:0;padding:0;color:#222} .item-component__line--title{font-weight:700} .item-component__line--subtitle{color:#555;font-size:0.95em} .item-component__line--desc{color:#666;font-size:0.9em} .item-component__textarea{width:100%;box-sizing:border-box;padding:6px;font:inherit;border:1px solid #ccc;border-radius:4px} /* Responsive: on small screens show 1 or 2 columns */ @media (max-width: 900px){ .item-component-grid{grid-template-columns:repeat(2,1fr)} } @media (max-width: 560px){ .item-component-grid{grid-template-columns:repeat(1,1fr)} } `; document.head.appendChild(style); return true; })(); /** * Create an item component element. * @param {Object} opts * @param {string} opts.imgSrc - image URL * @param {string} opts.imgAlt - image alt text * @param {string} opts.text1 - first text area (title) * @param {string} opts.text2 - second text area (subtitle) * @param {string} opts.text3 - third text area (description) * @param {boolean} opts.editable - if true, text areas are `