accords-library.com/src/components/Button.tsx

31 lines
699 B
TypeScript
Raw Normal View History

2022-01-31 12:16:30 +00:00
import Link from "next/link";
type ButtonProps = {
className?: string;
2022-01-31 12:16:30 +00:00
href?: string;
children: React.ReactChild | React.ReactChild[];
};
export default function Button(props: ButtonProps): JSX.Element {
2022-01-31 12:16:30 +00:00
const button = (
<div
className={
"grid place-content-center place-items-center border-[1px] border-dark text-dark rounded-full cursor-pointer px-4 py-2 transition-colors hover:text-light hover:bg-dark" +
" " +
props.className
}
>
{props.children}
</div>
);
2022-01-31 12:16:30 +00:00
const result = props.href ? (
<Link href={props.href} passHref>
{button}
</Link>
) : (
button
);
return result;
}