{"version":3,"file":"NoteMagazineList.FUbOmOJT.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/qxZsgV53Dx5eQ5kOAAjC/x5k4i0Iunl92lSc6CTMk/NoteMagazineList.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function formatDateJP(dateStr){if(!dateStr)return\"\";const d=new Date(dateStr);if(Number.isNaN(d.getTime()))return\"\";return`${d.getFullYear()}年${d.getMonth()+1}月${d.getDate()}日`;}function parseIndexes(indexesText){if(!indexesText||typeof indexesText!==\"string\")return[];return indexesText.split(\",\").map(v=>parseInt(v.trim(),10)).filter(v=>!Number.isNaN(v)&&v>=1).map(v=>v-1);}export default function NoteMagazineList(props){const{jsonUrl,maxItems,indexes,fallbackImage,borderColor,textColor,dateColor,placeholderColor}=props;const[items,setItems]=React.useState([]);const[loading,setLoading]=React.useState(true);const[error,setError]=React.useState(\"\");React.useEffect(()=>{let isMounted=true;async function loadData(){try{setLoading(true);setError(\"\");const res=await fetch(jsonUrl);if(!res.ok)throw new Error(\"failed\");const data=await res.json();let list=Array.isArray(data.items)?data.items:[];const selectedIndexes=parseIndexes(indexes);if(selectedIndexes.length>0){list=selectedIndexes.map(i=>list[i]).filter(Boolean);}else{list=list.slice(0,maxItems);}if(isMounted)setItems(list);}catch(e){if(isMounted)setError(\"記事の読み込みに失敗しました\");}finally{if(isMounted)setLoading(false);}}loadData();return()=>{isMounted=false;};},[jsonUrl,maxItems,indexes]);if(loading){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"24px\",boxSizing:\"border-box\",fontSize:\"16px\",color:textColor,fontFamily:'\"Noto Sans JP\", sans-serif'},children:\"読み込み中…\"});}if(error){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"24px\",boxSizing:\"border-box\",fontSize:\"16px\",color:\"#c00\",fontFamily:'\"Noto Sans JP\", sans-serif'},children:error});}if(!items.length){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"24px\",boxSizing:\"border-box\",fontSize:\"16px\",color:textColor,fontFamily:'\"Noto Sans JP\", sans-serif'},children:\"記事がありません\"});}return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",minHeight:\"200px\",fontFamily:'\"Noto Sans JP\", sans-serif',color:textColor,background:\"transparent\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .qbo-note-list {\n                    width: 100%;\n                }\n\n                .qbo-note-item {\n                    display: grid;\n                    grid-template-columns: 130px 120px minmax(0, 1fr);\n                    column-gap: 16px;\n                    align-items: center;\n                    padding: 16px 0;\n                    border-bottom: 1px solid ${borderColor};\n                    text-decoration: none;\n                    color: ${textColor};\n                    box-sizing: border-box;\n                }\n\n                .qbo-note-item:first-child {\n                    border-top: 1px solid ${borderColor};\n                }\n\n                .qbo-note-date {\n                    width: 130px;\n                    font-size: 14px;\n                    line-height: 1.5;\n                    color: ${dateColor};\n                    white-space: nowrap;\n                    box-sizing: border-box;\n                }\n\n                .qbo-note-media {\n                    width: 120px;\n                    height: 72px;\n                    border-radius: 6px;\n                    overflow: hidden;\n                    background: ${placeholderColor};\n                    flex-shrink: 0;\n                    display: flex;\n                    align-items: center;\n                    justify-content: center;\n                }\n\n                .qbo-note-image {\n                    width: 100%;\n                    height: 100%;\n                    object-fit: cover;\n                    display: block;\n                    transition: opacity 0.2s ease;\n                }\n\n                .qbo-note-title {\n                    min-width: 0;\n                    font-size: 16px;\n                    line-height: 1.55;\n                    font-weight: 400;\n                    letter-spacing: 0;\n                    word-break: break-word;\n                    overflow-wrap: anywhere;\n                    transition: color 0.2s ease;\n                }\n\n                .qbo-note-item:hover .qbo-note-title {\n                    color: #F08160;\n                }\n\n                .qbo-note-item:hover .qbo-note-image {\n                    opacity: 0.85;\n                }\n\n                @media (max-width: 768px) {\n                    .qbo-note-item {\n                        grid-template-columns: 1fr;\n                        row-gap: 10px;\n                        padding: 16px 0;\n                    }\n\n                    .qbo-note-date {\n                        width: 100%;\n                        font-size: 13px;\n                        order: 2;\n                    }\n\n                    .qbo-note-media {\n                        width: 100%;\n                        height: auto;\n                        aspect-ratio: 16 / 9;\n                        order: 1;\n                    }\n\n                    .qbo-note-title {\n                        font-size: 15px;\n                        line-height: 1.6;\n                        order: 3;\n                    }\n                }\n            `}),/*#__PURE__*/_jsx(\"div\",{className:\"qbo-note-list\",children:items.map((item,index)=>{const imageSrc=item.image||fallbackImage||\"\";const hasImage=Boolean(imageSrc&&imageSrc.trim());return /*#__PURE__*/_jsxs(\"a\",{href:item.link||\"#\",target:\"_blank\",rel:\"noreferrer\",className:\"qbo-note-item\",children:[/*#__PURE__*/_jsx(\"div\",{className:\"qbo-note-date\",children:formatDateJP(item.pubDate)}),/*#__PURE__*/_jsx(\"div\",{className:\"qbo-note-media\",children:hasImage?/*#__PURE__*/_jsx(\"img\",{className:\"qbo-note-image\",src:imageSrc,alt:item.title||\"\",onError:e=>{const target=e.currentTarget;if(fallbackImage&&target.src!==fallbackImage){target.src=fallbackImage;}else{target.style.display=\"none\";}}}):null}),/*#__PURE__*/_jsx(\"div\",{className:\"qbo-note-title\",children:item.title||\"\"})]},`${item.link||\"item\"}-${index}`);})})]});}NoteMagazineList.defaultProps={jsonUrl:\"https://note-api-5ekj.vercel.app/api/note-feed\",maxItems:4,indexes:\"\",fallbackImage:\"\",borderColor:\"#d9d9d9\",textColor:\"#222222\",dateColor:\"#222222\",placeholderColor:\"#f3f3f3\"};addPropertyControls(NoteMagazineList,{jsonUrl:{type:ControlType.String,title:\"JSON URL\"},maxItems:{type:ControlType.Number,title:\"件数\",min:1,max:12,step:1},indexes:{type:ControlType.String,title:\"表示番号\",placeholder:\"1,2,3,5\"},fallbackImage:{type:ControlType.Image,title:\"代替画像\"},borderColor:{type:ControlType.Color,title:\"罫線\"},textColor:{type:ControlType.Color,title:\"文字色\"},dateColor:{type:ControlType.Color,title:\"日付色\"},placeholderColor:{type:ControlType.Color,title:\"画像背景\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NoteMagazineList\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NoteMagazineList.map"],"mappings":"mLAAyI,SAAS,EAAa,EAAQ,CAAC,GAAG,CAAC,EAAQ,MAAM,GAAG,IAAM,EAAE,IAAI,KAAK,EAAQ,CAAuC,OAAnC,OAAO,MAAM,EAAE,SAAS,CAAC,CAAO,GAAS,GAAG,EAAE,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,GAAI,SAAS,EAAa,EAAY,CAAyD,MAArD,CAAC,GAAa,OAAO,GAAc,SAAe,EAAE,CAAQ,EAAY,MAAM,IAAI,CAAC,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,EAAE,CAAE,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,UAAQ,WAAS,UAAQ,gBAAc,cAAY,YAAU,YAAU,oBAAkB,EAAW,CAAC,EAAM,GAAUA,EAAe,EAAE,CAAC,CAAM,CAAC,EAAQ,GAAYA,EAAe,GAAK,CAAM,CAAC,EAAM,GAAUA,EAAe,GAAG,CAAiqC,OAAhqC,MAAoB,CAAC,IAAI,EAAU,GAAK,eAAe,GAAU,CAAC,GAAG,CAAC,EAAW,GAAK,CAAC,EAAS,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,EAAQ,CAAC,GAAG,CAAC,EAAI,GAAG,MAAU,MAAM,SAAS,CAAC,IAAM,EAAK,MAAM,EAAI,MAAM,CAAK,EAAK,MAAM,QAAQ,EAAK,MAAM,CAAC,EAAK,MAAM,EAAE,CAAO,EAAgB,EAAa,EAAQ,CAAC,AAAwF,EAArF,EAAgB,OA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