diff --git a/components/buttons/Button.tsx b/components/buttons/Button.tsx index d3892ea2866..9c96e7dd7d6 100644 --- a/components/buttons/Button.tsx +++ b/components/buttons/Button.tsx @@ -1,15 +1,17 @@ import Link from 'next/link'; import { twMerge } from 'tailwind-merge'; +import { ButtonIconPosition, ButtonSize, ButtonType } from '@/types/components/buttons/ButtonPropsType'; + type IButtonProps = { text: string; icon?: React.ReactNode; - iconPosition?: 'left' | 'right'; + iconPosition?: ButtonIconPosition; target?: string; bgClassName?: string; textClassName?: string; - buttonSize?: 'small' | 'default'; - type?: 'submit' | 'reset' | 'button'; + buttonSize?: ButtonSize; + type?: ButtonType; } & ( | ({ href: string; @@ -22,14 +24,14 @@ type IButtonProps = { /** * @name Button * @param {string} props.text - The text to be displayed on the button. - * @param {string} props.type - The type of the button. Defaults to 'button'. + * @param {ButtonType} props.type - The type of the button. Defaults to 'button'. * @param {string} props.target - The target attribute for the anchor tag. Defaults to '_self'. * @param {React.ReactNode} props.icon - The icon to be displayed on the button. - * @param {string} props.iconPosition - The position of the icon. Defaults to 'right'. + * @param {ButtonIconPosition} props.iconPosition - The position of the icon. Defaults to 'right'. * @param {string} props.className - The class name to be applied to the button. * @param {string} props.bgClassName - The class name to be applied to the button's background. * @param {string} props.textClassName - The class name to be applied to the button's text. - * @param {string} props.buttonSize - The size of the button. Defaults to 'default'. + * @param {ButtonSize} props.buttonSize - The size of the button. Defaults to 'default'. * @param {string} props.href - The href attribute for the anchor tag. * @description The Button component is a reusable button component that can be used to render a button or an anchor tag * @description The component accepts button or anchor tag props based on the presence of the href prop. @@ -38,19 +40,19 @@ type IButtonProps = { */ export default function Button({ text, - type = 'button', + type = ButtonType.BUTTON, target = '_self', icon, - iconPosition = 'right', + iconPosition = ButtonIconPosition.RIGHT, className, bgClassName = twMerge('bg-primary-500 hover:bg-primary-400'), textClassName = twMerge('text-white'), buttonSize, ...props }: IButtonProps): React.ReactElement { - const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} transition-all duration-500 + const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} transition-all duration-500 ease-in-out rounded-md px-3 py-2 text-sm font-medium tracking-heading ${className || ''}`); - const classNames = twMerge(`${bgClassName} ${textClassName} transition-all duration-500 ease-in-out + const classNames = twMerge(`${bgClassName} ${textClassName} transition-all duration-500 ease-in-out rounded-md px-4 py-3 text-md font-semibold tracking-heading ${className || ''}`); if (!props.href) { @@ -58,16 +60,16 @@ export default function Button({