diff --git a/apps/site/components/Common/Button/index.tsx b/apps/site/components/Common/Button/index.tsx index bf19cfc5cffd3..218051d2a78fd 100644 --- a/apps/site/components/Common/Button/index.tsx +++ b/apps/site/components/Common/Button/index.tsx @@ -1,18 +1,16 @@ 'use client'; import classNames from 'classnames'; -import type { - FC, - AnchorHTMLAttributes, - KeyboardEvent, - MouseEvent, -} from 'react'; +import type { FC, AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'; import Link from '@/components/Link'; import styles from './index.module.css'; -type ButtonProps = AnchorHTMLAttributes & { +type ButtonProps = ( + | AnchorHTMLAttributes + | ButtonHTMLAttributes +) & { kind?: 'neutral' | 'primary' | 'secondary' | 'special'; size?: 'default' | 'small'; disabled?: boolean; @@ -22,55 +20,44 @@ const Button: FC = ({ kind = 'primary', size = 'default', disabled = false, - href = undefined, children, className, - onClick, ...props }) => { - const onKeyDownHandler = (e: KeyboardEvent) => { - if (disabled) { - e.preventDefault(); - return; - } - - if (e.key === 'Enter' || e.key === ' ') { - e.preventDefault(); - if (typeof onClick === 'function') { - onClick(e as unknown as MouseEvent); - } - } - }; - - const onClickHandler = (e: MouseEvent) => { - if (disabled) { - e.preventDefault(); - return; - } - - if (typeof onClick === 'function') { - onClick(e); - } - }; + if ('href' in props) { + return ( + + {children} + + ); + } return ( - )} > {children} - + ); };