0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(console): TabNavItem props type (#2630)

This commit is contained in:
Xiao Yijun 2022-12-12 13:53:47 +08:00 committed by GitHub
parent 25f0a2e158
commit 2c1640d889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,14 +6,24 @@ import { onKeyDownHandler } from '@/utilities/a11y';
import * as styles from './TabNavItem.module.scss';
type Props = {
href?: string;
type BaseProps = {
isActive?: boolean;
errorCount?: number;
onClick?: () => void;
children: React.ReactNode;
};
type LinkStyleProps = {
href: string;
};
type TabStyleProps = {
onClick: () => void;
};
type Props =
| (BaseProps & LinkStyleProps & Partial<Record<keyof TabStyleProps, undefined>>)
| (BaseProps & TabStyleProps & Partial<Record<keyof LinkStyleProps, undefined>>);
const TabNavItem = ({ children, href, isActive, errorCount = 0, onClick }: Props) => {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const location = useLocation();