Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

참여자 목록을 보여주는 기능 추가 #111

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
description: '볼 함 차보까?',
title: '볼 함 차보까?',
children: '내용',
},
render: (args) => <MoimDescription {...args} />,
};
12 changes: 7 additions & 5 deletions frontend/src/components/MoimDescription/MoimDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { ReactNode } from 'react';
import * as S from './MoimDescription.style';

interface MoimDescriptionProps {
description: string;
title: string;
children: ReactNode;
}

export default function MoimDescription(props: MoimDescriptionProps) {
const { description } = props;
const { title, children } = props;

if (description === '') {
if (title === '') {
return;
}

return (
<div css={S.containerStyle}>
<h2 css={S.titleStyle}>상세설명</h2>
<p css={S.descriptionStyle}>{description}</p>
<h2 css={S.titleStyle}>{title}</h2>
<div css={S.descriptionStyle}>{children}</div>
</div>
);
}
13 changes: 12 additions & 1 deletion frontend/src/pages/MoimDetailPage/MoimDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,18 @@ export default function MoimDetailPage() {
<MoimSummary moimInfo={moim} />
<MoimInformation moimInfo={moim} />

{moim.description && <MoimDescription description={moim.description} />}
{moim.description && (
<MoimDescription title={'상세설명'}>
{moim.description}
</MoimDescription>
)}
{moim.participants && (
<MoimDescription title="참여자">
{moim.participants.map((nickName) => {
return <p key={nickName}>{nickName}</p>;
})}
</MoimDescription>
)}

<LabeledInput
title="참가자 이름"
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export interface MoimInfo {
maxPeople: number;
currentPeople: number;
authorNickname: string;
participants: string[];
description?: string;
}

export type MoimInputInfo = Omit<MoimInfo, 'moimId' | 'currentPeople'>;
export type MoimInputInfo = Omit<
MoimInfo,
'moimId' | 'currentPeople' | 'participants'
>;
Loading