From ddc8faef1f67aa83c45554b90d52ae9ca669c59c Mon Sep 17 00:00:00 2001 From: Truls Henrik Jakobsen Date: Fri, 29 Nov 2024 11:53:56 +0100 Subject: [PATCH] chore: fallback if no color is supplied to Badge --- src/components/badge/Badge.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/badge/Badge.tsx b/src/components/badge/Badge.tsx index cde0a0a50..8324fef98 100644 --- a/src/components/badge/Badge.tsx +++ b/src/components/badge/Badge.tsx @@ -8,14 +8,13 @@ interface IBadge { textColor?: string; } -const Badge = ({ - children, - badgeColor = "#EAEAEA", - textColor = "#222424", -}: IBadge) => { +const DEFAULT_BADGE_COLOR = "#EAEAEA"; +const DEFAULT_TEXT_COLOR = "#222424"; + +const Badge = ({ children, badgeColor, textColor }: IBadge) => { const badgeColors = { - backgroundColor: badgeColor, - color: textColor, + backgroundColor: badgeColor || DEFAULT_BADGE_COLOR, + color: textColor || DEFAULT_TEXT_COLOR, }; return (