-
Notifications
You must be signed in to change notification settings - Fork 0
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 #155 from boostcampwm-2022/feat/main-page
๋ฉ์ธํ์ด์ง ๊ตฌํ
- Loading branch information
Showing
20 changed files
with
523 additions
and
36 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
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
32 changes: 32 additions & 0 deletions
32
client/src/components/Card/RecruitTextCard/RecruitTextCard.tsx
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,32 @@ | ||
import DetailLabel from "#components/DetailLabel/DetailLabel"; | ||
import { Recruit } from "#types/Recruit"; | ||
import { getDisplayPaceString } from "#utils/stringUtils"; | ||
import { useNavigate } from "react-router-dom"; | ||
import styled from "styled-components"; | ||
|
||
const Card = styled.div` | ||
padding: 12px 16px; | ||
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25); | ||
border-radius: 8px; | ||
div:not(:last-child) { | ||
margin-bottom: 30px; | ||
} | ||
`; | ||
|
||
interface RecruitTextCardProps { | ||
data: Recruit; | ||
} | ||
|
||
const RecruitTextCard = ({ data }: RecruitTextCardProps) => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<Card onClick={() => navigate(`/recruit/${data.id}`)}> | ||
<DetailLabel title="์ถ๋ฐ์ " value={data.course.hDong.name || ""} /> | ||
<DetailLabel title="์ด๊ฑฐ๋ฆฌ" value={`${(data.course.pathLength / 1000).toFixed(1)}km`} /> | ||
<DetailLabel title="ํ์ด์ค" value={getDisplayPaceString(data.pace)} /> | ||
<DetailLabel title="์ฐธ๊ฐ ํํฉ" value={`${data.currentPpl}/${data.maxPpl}`} /> | ||
<DetailLabel title="์งํฉ ์ผ์" value={data.startTime.toLocaleString()} /> | ||
</Card> | ||
); | ||
}; | ||
export default RecruitTextCard; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import useHttpGet from "#hooks/http/useHttpGet"; | ||
import { Course } from "#types/Course"; | ||
import HttpResponse from "#types/dto/HttpResponse"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
const useCoursesQuery = () => { | ||
const { get } = useHttpGet<HttpResponse<Course[]>>(); | ||
return useQuery<HttpResponse<Course[]>>(["course"], async () => get(`/course`).then((res) => res || {})); | ||
}; | ||
|
||
export default useCoursesQuery; |
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 |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import useHttpGet from "#hooks/http/useHttpGet"; | ||
import HttpResponse from "#types/dto/HttpResponse"; | ||
import { Recruit } from "#types/Recruit"; | ||
import { RecruitDetail } from "#types/RecruitDetail"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
const useRecruitDetailQuery = (id: number) => { | ||
const { get } = useHttpGet<HttpResponse<Recruit>>(); | ||
return useQuery<Recruit>(["recruit", id], async () => get(`/recruit/${id}`).then((res) => res.data), { | ||
refetchInterval: 2000, | ||
}); | ||
const { get } = useHttpGet<HttpResponse<RecruitDetail>>(); | ||
return useQuery<RecruitDetail>(["recruit", id], async () => get(`/recruit/${id}`).then((res) => res.data)); | ||
}; | ||
export default useRecruitDetailQuery; |
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,11 @@ | ||
import useHttpGet from "#hooks/http/useHttpGet"; | ||
import HttpResponse from "#types/dto/HttpResponse"; | ||
import { Recruit } from "#types/Recruit"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
const useRecruitsQuery = () => { | ||
const { get } = useHttpGet<HttpResponse<Recruit[]>>(); | ||
return useQuery<HttpResponse<Recruit[]>>(["recruit"], async () => get(`/recruit`).then((res) => res || {})); | ||
}; | ||
|
||
export default useRecruitsQuery; |
Oops, something went wrong.