forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
33 lines (28 loc) · 754 Bytes
/
index.tsx
File metadata and controls
33 lines (28 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import classNames from 'classnames';
import type { FC, AnchorHTMLAttributes } from 'react';
import Link from '@/components/Link';
import styles from './index.module.css';
type ButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
kind?: 'neutral' | 'primary' | 'secondary' | 'special';
// We have an extra `disabled` prop as we simulate a button
disabled?: boolean;
};
const Button: FC<ButtonProps> = ({
kind = 'primary',
disabled = false,
href = undefined,
children,
className,
...props
}) => (
<Link
role="button"
href={disabled ? undefined : href}
aria-disabled={disabled}
className={classNames(styles.button, styles[kind], className)}
{...props}
>
{children}
</Link>
);
export default Button;