feat(mobile): explorer create/rename operation (#8628)

close AF-1560
This commit is contained in:
CatsJuice
2024-11-04 05:28:05 +00:00
parent 12e3cf1d07
commit 4cbf4b74d6
44 changed files with 1139 additions and 252 deletions
@@ -7,19 +7,20 @@ import { useMenuItem } from '../use-menu-item';
import { MobileMenuContext } from './context';
export const MobileMenuSub = ({
title,
children: propsChildren,
items,
triggerOptions,
subContentOptions: contentOptions = {},
}: MenuSubProps) => {
}: MenuSubProps & { title?: string }) => {
const {
className,
children,
otherProps: { onClick, ...otherTriggerOptions },
} = useMenuItem({
...triggerOptions,
children: propsChildren,
suffixIcon: <ArrowRightSmallPlusIcon />,
...triggerOptions,
});
return (
@@ -27,6 +28,7 @@ export const MobileMenuSub = ({
onClick={onClick}
items={items}
subContentOptions={contentOptions}
title={title}
>
<div className={className} {...otherTriggerOptions}>
{children}
@@ -36,19 +38,23 @@ export const MobileMenuSub = ({
};
export const MobileMenuSubRaw = ({
title,
onClick,
children,
items,
subContentOptions: contentOptions = {},
}: MenuSubProps & { onClick?: (e: MouseEvent<HTMLDivElement>) => void }) => {
}: MenuSubProps & {
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
title?: string;
}) => {
const { setSubMenus } = useContext(MobileMenuContext);
const onItemClick = useCallback(
(e: MouseEvent<HTMLDivElement>) => {
onClick?.(e);
setSubMenus(prev => [...prev, { items, contentOptions }]);
setSubMenus(prev => [...prev, { items, contentOptions, title }]);
},
[contentOptions, items, onClick, setSubMenus]
[contentOptions, items, onClick, setSubMenus, title]
);
return <Slot onClick={onItemClick}>{children}</Slot>;