feat: improve styling

This commit is contained in:
chenos 2021-09-03 15:10:10 +08:00
parent 8bd5a83947
commit 8048482247
5 changed files with 92 additions and 17 deletions

View File

@ -76,7 +76,7 @@ export function Droppable(props: DroppableProps) {
return (
<Component
{...others}
className={cls(className, `droppable-${id}`, {
className={cls(className, `droppable droppable-${id}`, {
isOver,
})}
ref={(el: HTMLElement) => {
@ -138,7 +138,7 @@ export function SortableItem(props: SortableItemProps) {
<Component
{...others}
// {...attributes}
className={cls(className, `droppable-${id}`, {
className={cls(className, `droppable droppable-${id}`, {
isOver,
isDragging,
})}

View File

@ -398,11 +398,27 @@ Menu.SubMenu = observer((props: any) => {
) : (
<AntdMenu.SubMenu
{...props}
icon={<IconPicker type={icon} />}
icon={null}
// icon={<IconPicker type={icon} />}
title={
<>
{schema.title} <DesignableBar />
</>
<SortableItem
id={schema.name}
data={{
title: schema.title,
path: getSchemaPath(schema),
}}
>
{icon && (
<span style={{ marginRight: 10 }}>
<IconPicker type={icon} />
</span>
)}
{schema.title}
<DesignableBar />
</SortableItem>
// <>
// {schema.title} <DesignableBar />
// </>
}
eventKey={schema.name}
key={schema.name}
@ -734,16 +750,13 @@ Menu.DesignableBar = (props) => {
_.set(initialValues, name, get(schema, name));
},
);
const values = await FormDialog(
`编辑菜单项`,
() => {
return (
<FormLayout layout={'vertical'}>
<SchemaField schema={formConfig.schema} />
</FormLayout>
);
},
).open({
const values = await FormDialog(`编辑菜单项`, () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField schema={formConfig.schema} />
</FormLayout>
);
}).open({
initialValues,
});
if (values.title) {

View File

@ -6,6 +6,10 @@
.ant-menu-horizontal {
width: 100%;
.ant-menu-item:active,
.ant-menu-submenu-title:active {
background-color: inherit !important;
}
}
.ant-menu-item-active .designable-bar {
@ -110,3 +114,39 @@
.nb-add-new-menu-item.menu-mode-inline {
margin: 0 14px;
}
.ant-menu-horizontal {
.ant-menu-submenu,
.ant-menu-item {
.droppable.isDragging {
opacity: .2;
}
.droppable:not(.isDragging).isOver::after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 100%;
width: 2px;
background-color: #f18b62;
}
}
}
.ant-menu-inline {
.ant-menu-submenu,
.ant-menu-item {
.droppable.isDragging {
opacity: .2;
}
.droppable:not(.isDragging).isOver::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: 2px;
width: 100%;
background-color: #f18b62;
}
}
}

View File

@ -173,7 +173,13 @@ export function SortableHeaderRow(props) {
}}
>
{createPortal(
<DragOverlay style={{ pointerEvents: 'none', whiteSpace: 'nowrap' }}>
<DragOverlay
dropAnimation={{
duration: 10,
easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)',
}}
style={{ pointerEvents: 'none', whiteSpace: 'nowrap' }}
>
{dragOverlayContent}
</DragOverlay>,
document.body,

View File

@ -242,4 +242,20 @@ td.nb-table-operation {
.field-interface-attachment {
margin-top: -13px;
margin-bottom: -13px;
}
.ant-table-cell {
&.droppable.isDragging {
opacity: .5;
background-color: rgba(241, 139, 98, 0.06) !important;
}
&.droppable:not(.isDragging).isOver::after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 100%;
width: 2px;
background-color: #f18b62;
}
}