mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
Fix: Icons collapsing in flex.
Feature: Remember what channel was opened last. Channels: ESC to focus message box / cancel editing.
This commit is contained in:
15
src/lib/ConditionalLink.tsx
Normal file
15
src/lib/ConditionalLink.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
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} />;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user