From dfce8c064d6a10fa93383c36a9fc7456a660b6ff Mon Sep 17 00:00:00 2001 From: Nick Grato Date: Tue, 2 Apr 2024 14:57:25 -0700 Subject: [PATCH] commit (#54) * commit * fixing pr callouts and adding tool tip padding --------- Co-authored-by: Nick Grato --- src/components/Badge/Badge.tsx | 13 +-- src/components/Badge/index.ts | 2 +- src/components/Button/Button.module.scss | 1 - src/components/Button/Button.tsx | 66 +++++++++++----- src/components/Button/index.ts | 2 +- src/components/Input/Input.module.scss | 9 ++- src/components/Input/Input.tsx | 72 +++++++++-------- src/components/Input/index.ts | 2 +- src/components/Notification/Notification.tsx | 26 ++---- .../Notification/NotificationMessage.tsx | 51 ++++++------ src/components/Notification/index.ts | 4 +- src/components/Notification/types.ts | 26 ++++++ src/components/Select/Select.module.scss | 1 - src/components/Select/Select.tsx | 12 ++- src/components/Switch/Switch.tsx | 12 +-- src/components/TextArea/TextArea.module.scss | 9 ++- src/components/TextArea/TextArea.tsx | 79 +++++++++++-------- src/components/TextArea/index.ts | 2 +- src/components/ToolTip/ToolTip.module.scss | 5 ++ src/components/ToolTip/ToolTip.tsx | 6 +- src/components/ToolTip/index.ts | 2 +- src/components/index.ts | 20 ++--- src/stories/Badge.stories.tsx | 25 +++--- src/stories/Button.stories.tsx | 7 ++ src/stories/Input.stories.tsx | 2 +- 25 files changed, 267 insertions(+), 189 deletions(-) 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 (