Skip to content

Commit

Permalink
Fix: Add team board title
Browse files Browse the repository at this point in the history
  • Loading branch information
yoouyeon committed Feb 17, 2024
1 parent e620e7f commit 9e68c4e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/app/teams/[id]/board/@detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const TeamBoardPostView = ({ params }: { params: { id: string } }) => {
if (!data || error)
return (
<StatusMessage
boardType={'BOARD'}
message={'문제가 발생했습니다.'}
onClickEditButton={() => setBoard('LIST', boardId, postId)}
author={!!data?.isAuthor}
Expand All @@ -64,14 +65,15 @@ const TeamBoardPostView = ({ params }: { params: { id: string } }) => {
if (isLoading)
return (
<StatusMessage
boardType={'BOARD'}
message={'게시글을 불러오는 중입니다...'}
onClickEditButton={() => setBoard('LIST', boardId, postId)}
author={!!data?.isAuthor}
/>
)
return (
<>
<DetailPage handleGoBack={handleGoBack}>
<DetailPage boardType={'BOARD'} handleGoBack={handleGoBack}>
{isPc && (
<CuButton
message={'이전 페이지'}
Expand Down
4 changes: 3 additions & 1 deletion src/app/teams/[id]/notice/@detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const TeamNoticeView = ({ params }: { params: { id: string } }) => {
if (!data || error)
return (
<StatusMessage
boardType={'NOTICE'}
message={'문제가 발생했습니다.'}
onClickEditButton={() => setNotice('EDIT', postId)}
author={!!data?.isAuthor}
Expand All @@ -61,14 +62,15 @@ const TeamNoticeView = ({ params }: { params: { id: string } }) => {
if (isLoading)
return (
<StatusMessage
boardType={'NOTICE'}
message={'공지사항을 불러오는 중입니다...'}
onClickEditButton={() => setNotice('EDIT', postId)}
author={!!data?.isAuthor}
/>
)
return (
<>
<DetailPage handleGoBack={handleGoBack}>
<DetailPage boardType={'NOTICE'} handleGoBack={handleGoBack}>
{isPc && (
<CuButton
message={'이전 페이지'}
Expand Down
20 changes: 17 additions & 3 deletions src/components/board/DetailPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import CuModal from '../CuModal'
import DynamicToastViewer from '../DynamicToastViewer'
import * as style from './DetailPanel.style'

type TBoardType = 'NOTICE' | 'BOARD'

interface IChildrenProps {
children: React.ReactNode
}
Expand All @@ -18,10 +20,12 @@ interface IDetailContentContainerProps {
}

interface IDetailPageProps extends IChildrenProps {
boardType: TBoardType
handleGoBack: () => void
}

interface IStatusMessageProps {
boardType: TBoardType
message: string
onClickEditButton?: () => void
author: boolean
Expand All @@ -34,7 +38,16 @@ interface IDetailContentProps {
content: string
}

export const DetailPage = ({ children, handleGoBack }: IDetailPageProps) => {
const title: Record<TBoardType, string> = {
NOTICE: '공지사항',
BOARD: '게시글',
}

export const DetailPage = ({
children,
boardType,
handleGoBack,
}: IDetailPageProps) => {
const { isPc } = useMedia()
if (isPc) {
return (
Expand All @@ -46,7 +59,7 @@ export const DetailPage = ({ children, handleGoBack }: IDetailPageProps) => {
return (
<CuModal
open={true}
title={'공지사항'}
title={title[boardType]}
onClose={handleGoBack}
mobileFullSize
>
Expand Down Expand Up @@ -89,13 +102,14 @@ export const DetailContentCotainer = ({
}

export const StatusMessage = ({
boardType,
message,
onClickEditButton,
author,
}: IStatusMessageProps) => {
return (
<DetailContentCotainer
containerTitle={'공지사항'}
containerTitle={title[boardType]}
onClickEditButton={onClickEditButton}
author={author}
>
Expand Down

0 comments on commit 9e68c4e

Please sign in to comment.