Files
overextended.github.io/components/button.tsx
T
JagandLuke 1d2c490b26 refactor: Add h1 headers to all pages missing it (#137)
* refactor: Add h1 headers to all pages missing it

* refactor: missed example h3

* change hooks example heading to bold text

---------

Co-authored-by: Luke <[email protected]>
2023-07-08 11:08:43 +02:00

67 lines
1.7 KiB
TypeScript

import React from 'react';
import { IconBrandGithub, IconTag, IconFileText, IconDownload, IconBrandNpm } from '@tabler/icons-react';
interface Props {
icon?: React.ReactNode;
children?: React.ReactNode;
side?: 'left' | 'right';
link?: string;
label?: string;
}
const Button: React.FC = ({ side = 'left', children, icon, link }: Props) => {
return (
<div className="h-fit w-fit">
<a href={link}>
<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">
{side === 'left' && <div>{icon}</div>}
{children}
{side === 'right' && <div>{icon}</div>}
</div>
</a>
</div>
);
};
export default Button;
export function GhButton(props: Props) {
return (
<Button icon={<IconBrandGithub />} side={props.side} link={props.link}>
{props.label || "Github"}
</Button>
);
}
export function DocButton(props: Props) {
return (
<Button icon={<IconFileText />} side={props.side} link={props.link}>
{props.label || "Documentation"}
</Button>
);
}
export function DownloadButton(props: Props) {
return (
<Button icon={<IconDownload />} side={props.side} link={props.link}>
{props.label || "Download"}
</Button>
);
}
export function ReleaseButton(props: Props) {
return (
<Button icon={<IconTag />} side={props.side} link={props.link}>
{props.label || "Releases"}
</Button>
);
}
export function NpmButton(props: Props) {
return (
<Button icon={<IconBrandNpm />} side={props.side} link={props.link}>
{props.label || "Package"}
</Button>
);
}