Skip to content

Commit

Permalink
chore: fallback if no color is supplied to Badge
Browse files Browse the repository at this point in the history
  • Loading branch information
trulshj committed Nov 29, 2024
1 parent 88c10e5 commit ddc8fae
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className={styles.badgeWrapper} style={badgeColors}>
Expand Down

0 comments on commit ddc8fae

Please sign in to comment.