Skip to content

Commit 26e7b7e

Browse files
committed
Update button.tsx
1 parent 88ffe4f commit 26e7b7e

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

components/button.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import React, { ReactNode } from 'react';
1+
import React from 'react';
22
import { IconBrandGithub, IconTag, IconFileText, IconDownload, IconBrandNpm } from '@tabler/icons-react';
33

44
interface Props {
5-
icon?: JSX.Element;
6-
children?: ReactNode;
5+
icon?: React.ReactNode;
6+
children?: React.ReactNode;
77
side?: 'left' | 'right';
88
link?: string;
99
label?: string;
1010
}
1111

12-
const Button = ({ side = 'left', children, icon, link }: Props) => {
12+
const Button: React.FC = ({ side = 'left', children, icon, link }: Props) => {
1313
return (
1414
<div className="h-fit w-fit">
1515
<a href={link}>
1616
<div className="flex w-26 items-center justify-center gap-1.5 rounded-sm border border-black p-1.5 text-black hover:bg-black hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black mt-2">
17-
{side === 'left' && icon}
17+
{side === 'left' && <div>{icon}</div>}
1818
{children}
19-
{side === 'right' && icon}
19+
{side === 'right' && <div>{icon}</div>}
2020
</div>
2121
</a>
2222
</div>
@@ -25,42 +25,42 @@ const Button = ({ side = 'left', children, icon, link }: Props) => {
2525

2626
export default Button;
2727

28-
export function GhButton({ side, link, label }: Props) {
28+
export function GhButton(props: Props) {
2929
return (
30-
<Button icon={<IconBrandGithub />} side={side} link={link}>
31-
{label || "Github"}
30+
<Button icon={<IconBrandGithub />} side={props.side} link={props.link}>
31+
{props.label || "Github"}
3232
</Button>
3333
);
3434
}
3535

36-
export function DocButton({ side, link, label }: Props) {
36+
export function DocButton(props: Props) {
3737
return (
38-
<Button icon={<IconFileText />} side={side} link={link}>
39-
{label || "Documentation"}
38+
<Button icon={<IconFileText />} side={props.side} link={props.link}>
39+
{props.label || "Documentation"}
4040
</Button>
4141
);
4242
}
4343

44-
export function DownloadButton({ side, link, label }: Props) {
44+
export function DownloadButton(props: Props) {
4545
return (
46-
<Button icon={<IconDownload />} side={side} link={link}>
47-
{label || "Download"}
46+
<Button icon={<IconDownload />} side={props.side} link={props.link}>
47+
{props.label || "Download"}
4848
</Button>
4949
);
5050
}
5151

52-
export function ReleaseButton({ side, link, label }: Props) {
52+
export function ReleaseButton(props: Props) {
5353
return (
54-
<Button icon={<IconTag />} side={side} link={link}>
55-
{label || "Releases"}
54+
<Button icon={<IconTag />} side={props.side} link={props.link}>
55+
{props.label || "Releases"}
5656
</Button>
5757
);
5858
}
5959

60-
export function NpmButton({ side, link, label }: Props) {
60+
export function NpmButton(props: Props) {
6161
return (
62-
<Button icon={<IconBrandNpm />} side={side} link={link}>
63-
{label || "Package"}
62+
<Button icon={<IconBrandNpm />} side={props.side} link={props.link}>
63+
{props.label || "Package"}
6464
</Button>
6565
);
66-
}
66+
}

0 commit comments

Comments
 (0)