mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-11 08:48:15 +03:00
27 lines
647 B
TypeScript
27 lines
647 B
TypeScript
import React from "react";
|
|
import { Button } from "react-bootstrap";
|
|
import { ButtonVariant } from "react-bootstrap/esm/types";
|
|
import { JustChildren, SetState } from "types/react";
|
|
import { DoesMatchRoute } from "util/routing";
|
|
import LinkButton from "./LinkButton";
|
|
|
|
export default function SelectLinkButton({
|
|
children,
|
|
onVariant = "primary",
|
|
offVariant = "outline-secondary",
|
|
to,
|
|
}: {
|
|
onVariant?: ButtonVariant;
|
|
offVariant?: ButtonVariant;
|
|
to: string;
|
|
} & JustChildren) {
|
|
return (
|
|
<LinkButton
|
|
to={to}
|
|
className={`btn-${DoesMatchRoute(window.location.href, to) ? onVariant : offVariant}`}
|
|
>
|
|
{children}
|
|
</LinkButton>
|
|
);
|
|
}
|