'use client'; import './style.scss'; import Link from 'next/link'; import { useSearchParams } from 'next/navigation'; import { useMemo } from 'react'; import Post from '@/types/forum/post'; import { BoardListMeta } from '@/types/forum/boardMeta'; import { formatDate, isHotPost, isNewPost } from '@/lib/utils/client'; import NoticeListLayout from './NoticeListLayout'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faComment, faThumbsUp, faEye } from '@fortawesome/free-regular-svg-icons'; import { faFloppyDisk, faImage, faVideo } from '@fortawesome/free-solid-svg-icons'; interface Props { boardListMeta: BoardListMeta; speaker?: Post[]; notice?: Post[]; list: Post[]; startIndex?: number; onChange?: (_: number|undefined) => void; } export default function DefaultListLayout({boardListMeta, speaker = [], notice = [], list, startIndex, onChange}: Props) { const searchParams = useSearchParams(); const query = useMemo(() => Object.fromEntries(searchParams.entries()), [searchParams]); return ( <>
{/* 전체 공지 */} {/* 일반 공지 */} {/* 일반 글 */} {list.length > 0 && ( list.map((row, i) => { const isNew = isNewPost(boardListMeta.isNewIcon, row); const isHot = isHotPost(boardListMeta.isHotIcon, row); const createdAt = formatDate(row.createdAt); const postViewUrl = {pathname: '/post/' + row.id, query}; return (
{/* PC */}
  1. {row.isNotice ? ( {startIndex !== undefined ? startIndex - i : i + 1} ) : ( 공지 )}
  2. {row.boardPrefix && row.boardPrefixID && onChange && ( )} {row.subject} {row.comments > 0 && [{row.comments}]} {row.files > 0 && } {row.images > 0 && } {row.videos > 0 && } {isNew && NEW} {isHot && HOT}
  3. {row.name || row.sid}
  4. {createdAt}
  5. {row.views}
  6. {row.likes}
{/* Mobile */}
); }) )} {list.length <= 0 && (

등록된 글이 없습니다.

)}
); }