mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-10 22:32:17 +02:00
38 lines
964 B
TypeScript
38 lines
964 B
TypeScript
import clsx from 'clsx';
|
|
import { memo } from 'react';
|
|
import { Link, LinkProps } from 'react-router-dom';
|
|
|
|
import styles from './sidebar-item.module.css';
|
|
|
|
import { Button, ButtonProps } from '/@/shared/components/button/button';
|
|
|
|
interface SidebarItemProps extends ButtonProps {
|
|
to: LinkProps['to'];
|
|
}
|
|
|
|
export const SidebarItem = ({ children, className, to, ...props }: SidebarItemProps) => {
|
|
return (
|
|
<Button
|
|
className={clsx(
|
|
{
|
|
[styles.disabled]: props.disabled,
|
|
[styles.link]: true,
|
|
},
|
|
className,
|
|
)}
|
|
classNames={{
|
|
inner: styles.inner,
|
|
label: styles.label,
|
|
}}
|
|
component={Link}
|
|
to={to}
|
|
variant="subtle"
|
|
{...props}
|
|
>
|
|
{children}
|
|
</Button>
|
|
);
|
|
};
|
|
|
|
export const MemoizedSidebarItem = memo(SidebarItem);
|