-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from CSID-DGU/frontend/feature/api
FE: [feat] 크루멤버 프로필 조회, 달력, 다른크루 조회, 크루 채팅
- Loading branch information
Showing
30 changed files
with
619 additions
and
184 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import CalendarImg from "@/assets/images/calendar.png"; | ||
import Calendar from "react-calendar"; | ||
import "react-calendar/dist/Calendar.css"; | ||
import "@/styles/RunningCalendar.css"; | ||
import { MypageCalendarResponse } from "@/types/mypage"; | ||
|
||
type RunningCalendarProps = { | ||
runningData: MypageCalendarResponse[]; | ||
}; | ||
|
||
const RunningCalendar = ({ runningData = [] }: RunningCalendarProps) => { | ||
// 날짜에 해당하는 거리 가져오기 | ||
const getDistanceByDate = (date: Date): number => { | ||
const dateString = date.toISOString().split("T")[0]; // YYYY-MM-DD 포맷 | ||
const record = runningData.find((d) => d.date === dateString); | ||
return record?.totalDistance || 0.0; | ||
}; | ||
|
||
// 타일 스타일링 | ||
const tileContent = ({ date }: { date: Date }) => { | ||
const distance = getDistanceByDate(date); | ||
|
||
if (distance > 0) { | ||
return ( | ||
<div className="highlight flex justify-center items-center"> | ||
<p className="text-end text-[#444] font-bold"> | ||
{distance.toFixed(2)} <span className="text-[0.75rem]">km</span> | ||
</p> | ||
</div> | ||
); | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<div className="my-12 flex justify-center"> | ||
<Calendar | ||
tileContent={tileContent} // 날짜별 커스터마이징 | ||
className="running-calendar" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RunningCalendar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.