Skip to content

Commit 11c6397

Browse files
committed
chore(react): improve drag source styles
1 parent e8dc246 commit 11c6397

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/react/src/widgets/DragSourceWidget/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export const DragSourceWidget: React.FC<IDragSourceWidgetProps> = observer(
4646

4747
const source =
4848
workspace?.source?.size > 0 ? workspace.source : designer.source
49-
49+
const sources = source.getSourcesByGroup(props.name)
50+
const remainItems = sources.length % 3
5051
return (
5152
<div
5253
className={cls(prefix, props.className, {
@@ -70,10 +71,8 @@ export const DragSourceWidget: React.FC<IDragSourceWidgetProps> = observer(
7071
</div>
7172
<div className={prefix + '-content-wrapper'}>
7273
<div className={prefix + '-content'}>
73-
{source.mapSourcesByGroup(
74-
props.name,
75-
isFn(props.children) ? props.children : renderNode
76-
)}
74+
{sources.map(isFn(props.children) ? props.children : renderNode)}
75+
{remainItems && <div className={prefix + '-item-remain'}></div>}
7776
</div>
7877
</div>
7978
</div>

packages/react/src/widgets/DragSourceWidget/styles.less

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
position: relative;
6262
user-select: none;
6363
padding: 8px 10px;
64-
background: #fff;
64+
background: var(--dn-drag-source-content-bg-color);
6565
min-height: 40px;
6666
color: var(--dn-drag-source-item-color);
6767
display: flex;
@@ -76,9 +76,13 @@
7676
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
7777
z-index: 1;
7878
}
79+
7980
&-text {
8081
text-align: center;
8182
font-size: 12px;
8283
}
84+
&-remain {
85+
background: var(--dn-drag-source-content-bg-color);
86+
}
8387
}
8488
}

0 commit comments

Comments
 (0)