diff --git a/src/shared/Button.tsx b/src/shared/Button.tsx new file mode 100644 index 0000000..ed534e9 --- /dev/null +++ b/src/shared/Button.tsx @@ -0,0 +1,89 @@ +"use client"; + +import { Route } from "@/routers/types"; +import Link from "next/link"; +import React, { ButtonHTMLAttributes, FC } from "react"; + +export interface ButtonProps { + className?: string; + translate?: string; + sizeClass?: string; + fontSize?: string; + // + loading?: boolean; + disabled?: boolean; + type?: ButtonHTMLAttributes["type"]; + href?: Route; + targetBlank?: boolean; + onClick?: () => void; + children?: React.ReactNode; +} + +const Button: FC = ({ + className = "text-neutral-700 dark:text-neutral-200", + translate = "", + sizeClass = "px-4 py-3 sm:px-6", + fontSize = "text-sm sm:text-base font-medium", + disabled = false, + href, + children, + targetBlank, + type, + loading, + onClick = () => {}, +}) => { + const CLASSES = `nc-Button relative h-auto inline-flex items-center justify-center rounded-full transition-colors ${fontSize} ${sizeClass} ${translate} ${className} `; + + const _renderLoading = () => { + return ( + + + + + ); + }; + + if (!!href) { + return ( + + {children || `This is Link`} + + ); + } + + return ( + + ); +}; + +export default Button;