Feat/sidebar&top bar (#1454)

This commit is contained in:
Qi
2023-03-09 17:08:23 +08:00
committed by GitHub
parent 31d2e522eb
commit 921061eeb6
22 changed files with 259 additions and 541 deletions

View File

@@ -10,17 +10,19 @@ import { StyledArrow, StyledMenuItem } from './styles';
export type IconMenuProps = PropsWithChildren<{
isDir?: boolean;
icon?: ReactElement;
iconSize?: [number, number];
}> &
HTMLAttributes<HTMLButtonElement>;
export const MenuItem = forwardRef<HTMLButtonElement, IconMenuProps>(
({ isDir = false, icon, children, ...props }, ref) => {
({ isDir = false, icon, iconSize, children, ...props }, ref) => {
const [iconWidth, iconHeight] = iconSize || [16, 16];
return (
<StyledMenuItem ref={ref} {...props}>
{icon &&
cloneElement(icon, {
width: 16,
height: 16,
width: iconWidth,
height: iconHeight,
style: {
marginRight: 14,
...icon.props?.style,