Skip to content

Commit

Permalink
[#181] Fix: 빌드 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
DHyeon98 committed Jun 24, 2024
1 parent 63c0ddd commit 1d1f9d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pages/growth/[growthId]/content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { GrowthDetailsContent } from '@/types/growth/details';

interface ContentProps {
category: string;
content: GrowthDetailsContent;
content?: GrowthDetailsContent;
}

export default function Content({ category, content }: ContentProps) {
export default function Content({ category, content = {} as GrowthDetailsContent }: ContentProps) {
const getTitleColor = (category: string) => {
switch (category) {
case '간식':
Expand All @@ -32,13 +32,16 @@ export default function Content({ category, content }: ContentProps) {
return styles.foodContent;
}
};
const getTitleAndContent = () => {
const getTitleAndContent = (): { title: string; content: React.ReactNode } => {
switch (category) {
case '간식':
return { title: '간식', content: content.snack };
case '이상 증상':
return { title: '이상 증상', content: content.abnormalSymptom };
default:
if (!content.food) {
throw new Error('content.food 속성이 정의되지 않았습니다.');
}
return { title: '사료', content: content.food };
}
};
Expand Down

0 comments on commit 1d1f9d0

Please sign in to comment.