diff --git a/src/components/Common/NotificationBadge/NotificationBadge.tsx b/src/components/Common/NotificationBadge/NotificationBadge.tsx index 2a267c56..3b4bce09 100644 --- a/src/components/Common/NotificationBadge/NotificationBadge.tsx +++ b/src/components/Common/NotificationBadge/NotificationBadge.tsx @@ -1,61 +1,19 @@ +import { MAX_NOTIFICATION_COUNT } from '@/constants/maxNotificationCount'; import React from 'react'; -interface NotificationBadgeProps { - badgeType: 'basic' | 'dday'; +type NotificationBadgeProps = { count: number; -} +}; -export const NotificationBadge = ({ - badgeType, - count -}: NotificationBadgeProps) => { - const MAX_COUNT = 99; - const BaseStyle = - 'inline-flex items-center justify-center text-center align-text-middle'; - const styleMap = { - basic: 'bg-red-600 px-2 py-1 rounded-full text-white font-semibold', - dday: 'bg-yellow-400 px-2 py-1 rounded-sm text-white font-semibold' - }; +export const NotificationBadge = ({ count }: NotificationBadgeProps) => { + if (count <= 0) return null; // count가 0개 이하일 경우 렌더링하지 않습니다. - const renderContent = (badgeType: 'basic' | 'dday', count: number) => { - switch (badgeType) { - case 'basic': - if (count > MAX_COUNT) { - return ( - <> - - + - - 99 - > - ); - } - return ( - <> - {count} - - + - - > - ); - case 'dday': - return ( - <> - D - - - - - {count} - > - ); - default: - return null; - } - }; + const renderCount = + count > MAX_NOTIFICATION_COUNT ? `${MAX_NOTIFICATION_COUNT}+` : count; return ( -