mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-24 01:01:00 -05:00
16 lines
366 B
TypeScript
16 lines
366 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>;
|
||
|
} else {
|
||
|
return <Link {...linkProps} />;
|
||
|
}
|
||
|
}
|