mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 20:51:26 +00:00
fix(ui): revamp dropable ui effect for glossary terms table (#13443)
* revamp dropable ui effect for glossary terms table * logic change for getting classname * supported one drop style
This commit is contained in:
parent
ec94eb0113
commit
e65f9600b3
@ -11,6 +11,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { isUndefined } from 'lodash';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { useDrag, useDrop } from 'react-dnd';
|
||||
@ -41,8 +42,7 @@ const DraggableBodyRow = <T extends DraggableUnion>({
|
||||
|
||||
return {
|
||||
isOver: monitor.isOver(),
|
||||
dropClassName:
|
||||
dragIndex < (index ?? 0) ? 'drop-over-downward' : 'drop-over-upward',
|
||||
dropClassName: dragIndex !== index ? 'drop-over-child' : '',
|
||||
};
|
||||
},
|
||||
hover: () => {
|
||||
@ -56,7 +56,7 @@ const DraggableBodyRow = <T extends DraggableUnion>({
|
||||
// here we are passing the drag record
|
||||
const [{ isDragging }, drag] = useDrag({
|
||||
type: DRAGGABLE_BODY_ROW,
|
||||
item: { record },
|
||||
item: { record, index },
|
||||
collect: (monitor) => ({
|
||||
isDragging: monitor.isDragging(),
|
||||
}),
|
||||
@ -71,7 +71,7 @@ const DraggableBodyRow = <T extends DraggableUnion>({
|
||||
|
||||
return (
|
||||
<tr
|
||||
className={`${className} ${isOver ? dropClassName : ''}`}
|
||||
className={classNames(isOver ? dropClassName : '')}
|
||||
ref={ref}
|
||||
style={{
|
||||
cursor: 'move',
|
||||
|
@ -68,7 +68,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.drop-over-upward {
|
||||
.drop-over-having-child {
|
||||
td {
|
||||
background: @active-color;
|
||||
}
|
||||
|
@ -89,21 +89,33 @@
|
||||
}
|
||||
|
||||
.drop-over-background {
|
||||
.drop-over-upward {
|
||||
.drop-over-child {
|
||||
td {
|
||||
background: @active-color;
|
||||
border-bottom: 2px solid @primary-color;
|
||||
border: 2px dashed @primary-color;
|
||||
border-left: transparent;
|
||||
|
||||
&:first-child {
|
||||
border-left: 2px dashed @primary-color;
|
||||
}
|
||||
&:last-child {
|
||||
border-right: 2px dashed @primary-color !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.drop-over-table {
|
||||
.ant-table-tbody {
|
||||
.ant-table-cell {
|
||||
background: @active-color;
|
||||
}
|
||||
tr.ant-table-row:hover > td {
|
||||
background: @active-color;
|
||||
.ant-table {
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
.ant-table-tbody {
|
||||
border: 2px dashed @primary-color;
|
||||
|
||||
td {
|
||||
background: @active-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user