mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
15 lines
360 B
TypeScript
15 lines
360 B
TypeScript
import { Link, LinkProps } from "react-router-dom";
|
|
|
|
type Props = LinkProps &
|
|
JSX.HTMLAttributes<HTMLAnchorElement> & {
|
|
active: boolean;
|
|
};
|
|
|
|
export default function ConditionalLink(props: Props) {
|
|
const { active, ...linkProps } = props;
|
|
|
|
if (active) {
|
|
return <a>{props.children}</a>;
|
|
}
|
|
return <Link {...linkProps} />;
|
|
}
|