Skip to content

Commit

Permalink
feat : seminar detail로 이동 router 추가 #19
Browse files Browse the repository at this point in the history
  • Loading branch information
bianbbc87 committed Apr 18, 2024
1 parent 7584e2f commit 817d830
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/seminar/thumbnail/SeminarThumbnailList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use client';

import React, { useState } from 'react';
import { useRouter } from 'next/navigation';
import SeminarThumbnail from "./SeminarThumbnail";
import { SEMINAR_DATA } from '@/constants/seminar/seminarData';
import Link from 'next/link'

/**
* @description
Expand All @@ -18,9 +20,10 @@ import { SEMINAR_DATA } from '@/constants/seminar/seminarData';
* @returns The rendered header component.
*/

const SeminarThumbnailList = ({ selectedCategory }: { selectedCategory: string }) => {
const [currentPage, setCurrentPage] = useState(1);
const itemsPerPage = 12; // 한 페이지당 표시할 항목 수
const SeminarThumbnailList = ({ selectedCategory }: { selectedCategory: string }) => {
const router = useRouter();
const [currentPage, setCurrentPage] = useState(1);
const itemsPerPage = 12; // 한 페이지당 표시할 항목 수

// topic으로 데이터 필터링
const filteredData = selectedCategory !== "all" ? SEMINAR_DATA.filter(seminar => seminar.topic === selectedCategory) : SEMINAR_DATA;
Expand All @@ -36,9 +39,10 @@ const SeminarThumbnailList = ({ selectedCategory }: { selectedCategory: string }
pageNumbers.push(i);
}

// 페이지 변경 함수
// 세미나 리스트 페이지네이션 함수
const paginate = (pageNumber: number) => {
setCurrentPage(pageNumber);
// /seminar/${seminar.id}/page
};


Expand All @@ -49,10 +53,15 @@ const SeminarThumbnailList = ({ selectedCategory }: { selectedCategory: string }
aspectRatio: 16/9,
}}>
{currentItems.map((seminar) => (
<Link
href={`/seminar/${seminar.id}`}
key={seminar.id}
>
<SeminarThumbnail
key={seminar.id}
data={seminar}
/>
</Link>
))}
</div>
{/* 페이지네이션 버튼 */}
Expand Down

0 comments on commit 817d830

Please sign in to comment.