'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 { formatDate } from '@/lib/utils/client'; 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 { list: Post[]; startIndex?: number; } export default function LatestListLayout({list, startIndex}: Props) { const searchParams = useSearchParams(); const query = useMemo(() => Object.fromEntries(searchParams.entries()), [searchParams]); return (
{list.length > 0 && ( list.map((row, i) => { const createdAt = formatDate(row.createdAt); const postViewUrl = {pathname: '/post/' + row.id, query}; return (
{/* PC */}
  1. {startIndex !== undefined ? startIndex - i : i + 1}
  2. {row.boardName}
  3. {row.boardPrefix && row.boardPrefixID && ( [{row.boardPrefix.name}] )} {row.subject} {row.comments > 0 && [{row.comments}]} {row.files > 0 && } {row.images > 0 && } {row.videos > 0 && }
  4. {row.name || row.sid}
  5. {createdAt}
  6. {row.views}
  7. {row.likes}
{/* Mobile */}
); }) )} {list.length <= 0 && (

등록된 글이 없습니다.

)}
); }