2025-09-27 12:14:16 +03:00
|
|
|
import { ComponentChildren } from "preact";
|
|
|
|
|
import Icon from "./Icon";
|
|
|
|
|
import "./Button.css";
|
|
|
|
|
|
|
|
|
|
interface ButtonProps {
|
|
|
|
|
href?: string;
|
|
|
|
|
iconSvg?: string;
|
|
|
|
|
text: ComponentChildren;
|
|
|
|
|
openExternally?: boolean;
|
2025-09-27 12:41:33 +03:00
|
|
|
className?: string;
|
2025-09-27 12:46:16 +03:00
|
|
|
outline?: boolean;
|
2025-09-27 12:14:16 +03:00
|
|
|
}
|
|
|
|
|
|
2025-09-27 12:46:16 +03:00
|
|
|
export default function Button({ href, iconSvg, openExternally, text, className, outline }: ButtonProps) {
|
2025-09-27 12:14:16 +03:00
|
|
|
return (
|
|
|
|
|
<a
|
2025-09-27 12:46:16 +03:00
|
|
|
className={`button ${className} ${outline ? "outline" : ""}`}
|
2025-09-27 12:14:16 +03:00
|
|
|
href={href}
|
|
|
|
|
target={openExternally ? "_blank" : undefined}
|
2025-09-27 13:18:48 +03:00
|
|
|
rel={openExternally ? "noopener noreferrer" : undefined}
|
2025-09-27 12:14:16 +03:00
|
|
|
>
|
|
|
|
|
{iconSvg && <><Icon svg={iconSvg} />{" "}</>}
|
|
|
|
|
{text}
|
|
|
|
|
</a>
|
|
|
|
|
)
|
|
|
|
|
}
|