-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat-fe: posts 라우트 List컴포넌트 빌드 (#349)
Co-authored-by: Jeongwoo Park <[email protected]>
- Loading branch information
1 parent
4f9b2fb
commit d8f824b
Showing
15 changed files
with
288 additions
and
21 deletions.
There are no files selected for viewing
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
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,17 @@ | ||
import dashboardApis from '@api/dashboard'; | ||
import type { Club } from '@customTypes/dashboard'; | ||
import QUERY_KEYS from '@hooks/queryKeys'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
interface UseGetDashboardsProps { | ||
dashboardId: string; | ||
} | ||
|
||
export default function useGetDashboards({ dashboardId }: UseGetDashboardsProps) { | ||
const { data, error, isLoading } = useQuery<Club>({ | ||
queryKey: [QUERY_KEYS.DASHBOARD, dashboardId], | ||
queryFn: () => dashboardApis.get({ dashboardId }), | ||
}); | ||
|
||
return { data, error, isLoading }; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"clubName": "크루루", | ||
"dashboards": [ | ||
{ | ||
"dashboardId": "1", | ||
"title": "프론트엔드 7기 모집", | ||
"stats": { | ||
"accept": 3, | ||
"fail": 3, | ||
"inProgress": 9, | ||
"total": 15 | ||
}, | ||
"postUrl": "https://www.cruru.kr/123543920/recruit", | ||
"startDate": "1900-01-21T00:00:00", | ||
"endDate": "2024-07-24T18:00:00" | ||
}, | ||
{ | ||
"dashboardId": "2", | ||
"title": "백엔드 7기 모집", | ||
"stats": { | ||
"accept": 3, | ||
"fail": 3, | ||
"inProgress": 9, | ||
"total": 15 | ||
}, | ||
"postUrl": "https://www.cruru.kr/98765101/recruit", | ||
"startDate": "1900-01-21T00:00:00", | ||
"endDate": "2024-07-24T20:30:00" | ||
}, | ||
{ | ||
"dashboardId": "3", | ||
"title": "안드로이드 7기 모집", | ||
"stats": { | ||
"accept": 3, | ||
"fail": 3, | ||
"inProgress": 9, | ||
"total": 15 | ||
}, | ||
"postUrl": "https://www.cruru.kr/7777890/recruit", | ||
"startDate": "1900-01-21T00:00:00", | ||
"endDate": "2024-07-24T21:00:00" | ||
} | ||
] | ||
} |
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
36 changes: 36 additions & 0 deletions
36
frontend/src/pages/DashBoardList/DashboardList.stories.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,36 @@ | ||
import { reactRouterParameters } from 'storybook-addon-remix-react-router'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import DashboardList from '.'; | ||
|
||
const meta: Meta<typeof DashboardList> = { | ||
title: 'Components/DashboardList', | ||
component: DashboardList, | ||
parameters: { | ||
layout: 'centered', | ||
docs: { | ||
description: { | ||
component: 'DashboardList 컴포넌트는 여러 대시보드를 리스트 형태로 보여줍니다.', | ||
}, | ||
}, | ||
reactRouter: reactRouterParameters({ | ||
location: { | ||
pathParams: { dashboardId: '1' }, | ||
}, | ||
routing: { path: '/dashboardId/:dashboardId' }, | ||
}), | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof DashboardList>; | ||
|
||
export const Default: Story = { | ||
decorators: [ | ||
(Child) => ( | ||
<div style={{ width: '900px', border: '1px solid gray' }}> | ||
<Child /> | ||
</div> | ||
), | ||
], | ||
}; |
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,10 +1,38 @@ | ||
import RecruitmentCard from '@components/recruitment/RecruitmentCard'; | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
import useGetDashboards from '@hooks/useGetDashboards'; | ||
import S from './style'; | ||
|
||
export default function DashboardList() { | ||
const { dashboardId } = useParams() as { dashboardId: string }; | ||
const { data } = useGetDashboards({ dashboardId }); | ||
const navigate = useNavigate(); | ||
|
||
const handleCardClick = (postId: number) => { | ||
navigate(`/dashboard/${dashboardId}/${postId}`); | ||
}; | ||
|
||
return ( | ||
<div> | ||
List | ||
{/* | ||
TODO: 여기에 PostList를 넣어주세요!!!!!! | ||
*/} | ||
</div> | ||
<S.Container> | ||
<S.Title>{data?.clubName}</S.Title> | ||
<S.CardGrid> | ||
{data?.dashboards.map((dashboard) => ( | ||
<RecruitmentCard | ||
key={dashboard.dashboardId} | ||
// TODO: dashboardId -> postId로 변경 | ||
dashboardId={Number(dashboard.dashboardId)} | ||
title={dashboard.title} | ||
postStats={dashboard.stats} | ||
startDate={dashboard.startDate} | ||
endDate={dashboard.endDate} | ||
onClick={handleCardClick} | ||
/> | ||
))} | ||
<S.AddCard onClick={() => navigate(`/dashboard/${dashboardId}/create`)}> | ||
<div>+</div> | ||
<span>새 공고 추가</span> | ||
</S.AddCard> | ||
</S.CardGrid> | ||
</S.Container> | ||
); | ||
} |
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,58 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
padding: 3.8rem 2.4rem; | ||
gap: 2.4rem; | ||
`; | ||
|
||
const Title = styled.h1` | ||
${({ theme }) => theme.typography.heading[700]} | ||
padding-bottom: 2.4rem; | ||
border-bottom: 1px solid ${({ theme }) => theme.baseColors.grayscale[300]}; | ||
`; | ||
|
||
const CardGrid = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, 37.8rem); | ||
gap: 2.4rem; | ||
`; | ||
|
||
const AddCard = styled.div` | ||
display: flex; | ||
height: 20rem; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
border: 0.2rem dashed ${({ theme }) => theme.baseColors.grayscale[600]}; | ||
border-radius: 0.5rem; | ||
padding: 2rem; | ||
cursor: pointer; | ||
text-align: center; | ||
&:hover { | ||
background-color: ${({ theme }) => theme.baseColors.grayscale[200]}; | ||
} | ||
div { | ||
font-size: 6rem; | ||
color: ${({ theme }) => theme.colors.brand.primary}; | ||
} | ||
span { | ||
${({ theme }) => theme.typography.common.large} | ||
color: ${({ theme }) => theme.baseColors.grayscale[800]}; | ||
} | ||
`; | ||
|
||
const S = { | ||
Container, | ||
Title, | ||
CardGrid, | ||
AddCard, | ||
}; | ||
|
||
export default S; |
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.