diff --git a/src/components/Badge/Badge.tsx b/src/components/Badge/Badge.tsx index 4d4b768..e063f5f 100644 --- a/src/components/Badge/Badge.tsx +++ b/src/components/Badge/Badge.tsx @@ -1,22 +1,15 @@ import React from 'react'; import styles from './Badge.module.scss'; -export enum BadgeCategoriesE { - PRIMARY = 'primary', - SECONDARY = 'secondary', -} +export type BadgeCategoriesT = 'primary' | 'secondary'; export type BadgePropsT = { name: string; - category: BadgeCategoriesE; + category: BadgeCategoriesT; classProp?: string; }; -const Badge = ({ - name, - category = BadgeCategoriesE.PRIMARY, - classProp = '', -}: BadgePropsT) => { +const Badge = ({ name, category = 'primary', classProp = '' }: BadgePropsT) => { return ( ; classProp?: string; + LinkComponent?: React.ComponentType<{ + href: string; + children: React.ReactNode; + className?: string; + id?: string; + onClick?: MouseEventHandler; + target?: string; + }>; }; type ButtonIconT = { - icon: IconT | undefined; + icon: IconT | React.ReactNode; hasText: boolean; position: 'left' | 'right'; }; const ButtonIcon = ({ icon, hasText, position = 'left' }: ButtonIconT) => { - if (!icon) { - return <>; - } + if (typeof icon !== 'string') return <>{icon}; return ( { const content = ( <> - {!iconPlacedRight && ( + {!iconPlacedRight && icon && ( - {content} - - ) : ( - // BUTTON + if (href && LinkComponent) { + // To support NextJs Link + return ( + + {content} + + ); + } + + if (href) { + // Fall back to a standard tag if LinkComponent is not provided + return ( + + {content} + + ); + } + // Button logic remains unchanged + return (