import{W as m,aG as N,aH as y,a as f,j as e,az as P,n as j,aB as k,aC as h,aD as n,T as l,aE as w,b as p,aI as g,c as u,w as E,k as T,Z as W,a6 as v,G as c,aq as A,aJ as B,aK as C}from"../index.Crez7j-Y.bundle.js";import{u as G}from"./useFetchNoticeList.g3uFeF0L.bundle.js";import{E as b}from"./EmptyContent.BRQ9JwMr.bundle.js";import"./BoardAPIs.CPUVoL2H.bundle.js";const I=({noticeList:r,isPending:t})=>{const o=m()[0],i=Number(o.get("pageNumber")||N),s=Number(o.get("pageSize")||y),a=(i-1)*s,{isDesktop:x,isMobile:d}=f();return e.jsxs(e.Fragment,{children:[x&&e.jsx(S,{isPending:t,noticeList:r,startNoticeNo:a}),d&&e.jsx(_,{isPending:t,noticeList:r,startNoticeNo:a})]})},S=r=>{const{noticeList:t,startNoticeNo:o,isPending:i}=r;return e.jsxs(P,{size:"small",sx:{"& th":{py:1,px:0,bgcolor:j},"& td":{px:0,py:2}},children:[e.jsx(k,{children:e.jsxs(h,{children:[e.jsx(n,{width:120,align:"center",children:e.jsx(l,{variant:"body",fontWeight:500,children:"번호"})}),e.jsx(n,{width:630,align:"center",children:e.jsx(l,{variant:"body",fontWeight:500,children:"제목"})}),e.jsx(n,{width:120,align:"center",children:e.jsx(l,{variant:"body",fontWeight:500,children:"조회수"})}),e.jsx(n,{width:120,align:"center",children:e.jsx(l,{variant:"body",fontWeight:500,children:"작성자"})}),e.jsx(n,{width:120,align:"center",children:e.jsx(l,{variant:"body",fontWeight:500,children:"작성일"})})]})}),e.jsxs(w,{children:[t&&t.items.length===0&&e.jsx(h,{children:e.jsx(n,{colSpan:5,children:e.jsx(b,{text:"조회된 게시글이 없습니다."})})}),i&&e.jsx(e.Fragment,{children:Array.from({length:5}).map((s,a)=>e.jsx(h,{children:Array.from({length:5}).map((x,d)=>e.jsx(n,{children:e.jsx(p,{height:30,width:"80%",sx:{mx:"auto"}})},"cell"+d))},"row"+a))}),t==null?void 0:t.items.map((s,a)=>e.jsx(g,{noticeNo:o+a+1,notice:s},s.articleNo))]})]})},_=r=>{const{noticeList:t,startNoticeNo:o,isPending:i}=r;return e.jsxs(u,{component:"ul",children:[i&&e.jsx(e.Fragment,{children:Array.from({length:3}).map((s,a)=>e.jsx(E,{sx:{px:0,py:2,borderBottom:"1px solid ".concat(T)},children:e.jsx(p,{variant:"rounded",height:100,width:"100%"})},a))}),t&&t.items.length===0&&e.jsx(b,{text:"조회된 게시글이 없습니다."}),t==null?void 0:t.items.map((s,a)=>e.jsx(g,{noticeNo:o+a+1,notice:s},s.articleNo))]})};function z(){var i,s;const[r]=m(),{data:t,isPending:o}=G(r);return e.jsx(u,{component:"main",bgcolor:j,py:{desktop:8,mobile:0},children:e.jsxs(W,{bgcolor:v,borderRadius:2,p:{desktop:4,mobile:0},gap:2,children:[e.jsx(c,{item:!0,desktop:12,mobile:12,children:e.jsx(A,{title:"공지사항"})}),e.jsx(c,{item:!0,desktop:12,mobile:11,mx:"auto",children:e.jsx(B,{totalCount:(i=t==null?void 0:t.totalCount)!=null?i:0})}),e.jsx(c,{item:!0,desktop:12,mobile:11,mx:"auto",children:e.jsx(I,{noticeList:t,isPending:o})}),e.jsx(c,{item:!0,desktop:12,mobile:11,mx:"auto",children:e.jsx(C,{totalCount:(s=t==null?void 0:t.totalCount)!=null?s:0})})]})})}export{z as default};