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

View File

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

View File

@ -6,6 +6,10 @@
.ant-menu-horizontal { .ant-menu-horizontal {
width: 100%; width: 100%;
.ant-menu-item:active,
.ant-menu-submenu-title:active {
background-color: inherit !important;
}
} }
.ant-menu-item-active .designable-bar { .ant-menu-item-active .designable-bar {
@ -110,3 +114,39 @@
.nb-add-new-menu-item.menu-mode-inline { .nb-add-new-menu-item.menu-mode-inline {
margin: 0 14px; 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( {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} {dragOverlayContent}
</DragOverlay>, </DragOverlay>,
document.body, document.body,

View File

@ -242,4 +242,20 @@ td.nb-table-operation {
.field-interface-attachment { .field-interface-attachment {
margin-top: -13px; margin-top: -13px;
margin-bottom: -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;
}
} }