mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2024-11-27 08:39:59 +08:00
can drop component on root
This commit is contained in:
parent
e7e479f32d
commit
be279c0079
@ -6,7 +6,7 @@ type Props = {
|
||||
title: string;
|
||||
isSelected: boolean;
|
||||
onClick: () => void;
|
||||
onClickRemove: () => void;
|
||||
onClickRemove?: () => void;
|
||||
noChevron: boolean;
|
||||
isExpanded?: boolean;
|
||||
onToggleExpanded?: () => void;
|
||||
@ -60,13 +60,15 @@ export const ComponentItemView: React.FC<Props> = props => {
|
||||
<Text color={isSelected ? 'red.500' : 'black'} onClick={onClick} cursor="pointer">
|
||||
{title}
|
||||
</Text>
|
||||
<IconButton
|
||||
variant="ghost"
|
||||
size="smx"
|
||||
aria-label="remove"
|
||||
icon={<DeleteIcon />}
|
||||
onClick={onClickRemove}
|
||||
/>
|
||||
{onClickRemove ? (
|
||||
<IconButton
|
||||
variant="ghost"
|
||||
size="smx"
|
||||
aria-label="remove"
|
||||
icon={<DeleteIcon />}
|
||||
onClick={onClickRemove}
|
||||
/>
|
||||
) : null}
|
||||
</HStack>
|
||||
</Box>
|
||||
);
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
} from '../../operations/Operations';
|
||||
import { ComponentItemView } from './ComponentItemView';
|
||||
import { ComponentTree } from './ComponentTree';
|
||||
import { Text, VStack } from '@chakra-ui/react';
|
||||
import { Box, Text, VStack } from '@chakra-ui/react';
|
||||
|
||||
export type ChildrenMap = Map<string, SlotsMap>;
|
||||
type SlotsMap = Map<string, ApplicationComponent[]>;
|
||||
@ -93,8 +93,14 @@ function RootItem() {
|
||||
eventBus.send('operation', new CreateComponentOperation(creatingComponent));
|
||||
};
|
||||
return (
|
||||
<Text onDrop={onDrop} width="full">
|
||||
Root
|
||||
</Text>
|
||||
<Box onDrop={onDrop} width="full">
|
||||
<ComponentItemView
|
||||
title="Root"
|
||||
isSelected={false}
|
||||
onClick={() => undefined}
|
||||
isDroppable={true}
|
||||
noChevron={true}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user