Skip to content

Commit

Permalink
Merge pull request #74 from PNU-AID/dev
Browse files Browse the repository at this point in the history
Dev: 최신순 정렬 및 타입 분류 표시 수정
  • Loading branch information
yeonddori authored Feb 25, 2024
2 parents e955ff8 + 77e7119 commit e708128
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/studypage/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function Posts({ studyList }: { studyList: StudyItem[] }) {
const handleSearch = (text: string) => {
setSearchText(text);
};
console.log(studyList);

const applyFilters = (itemsToFilter: StudyItem[]) => {
return itemsToFilter.filter((item) => {
Expand All @@ -90,7 +91,7 @@ export default function Posts({ studyList }: { studyList: StudyItem[] }) {

const filteredItems = searchText ? applyFilters(items) : items;
const sortedItems = filteredItems.sort((a, b) => {
return new Date(a.created_at).getTime() - new Date(b.created_at).getTime();
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
});

return (
Expand Down Expand Up @@ -137,7 +138,9 @@ export default function Posts({ studyList }: { studyList: StudyItem[] }) {
onClick={() => handleItemClick(item)}
>
<div className="flex justify-between mb-3 text-sm font-bold text-gray-400 border-b-2">
<span>{'study_name' in item ? '스터디' : '프로젝트'}</span>
<span>
{item.study_type === 'Study' ? '스터디' : '프로젝트'}
</span>
<span>
{item.study_end ? `~${item.study_end.split('T')[0]}` : ''}
</span>
Expand Down

0 comments on commit e708128

Please sign in to comment.