Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/collections/table): use a placeholder for items

Elian Dorance0da3fb80fd
diff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.css
index 72edc61a2f..9e672e22dc 100644
--- a/apps/client/src/widgets/collections/board/index.css
+++ b/apps/client/src/widgets/collections/board/index.css
@@ -150,10 +150,6 @@
box-shadow: 4px 8px 16px rgba(0, 0, 0, 0.5);
}
-.board-view-container .board-note.shift-down {
- transform: translateY(100%);
-}
-
.board-view-container .board-note.editing {
box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.35);
border-color: var(--main-text-color);
@@ -174,18 +170,19 @@
margin-right: 0.25em;
}
-.board-drop-indicator {
- height: 2px;
- background: linear-gradient(90deg, transparent, var(--main-text-color) 20%, var(--main-text-color) 80%, transparent);
- border-radius: 2px;
- margin: -1px 0;
+.board-drop-placeholder {
+ height: 40px;
+ margin: 0.65em 0;
+ padding: 0.5em;
+ border-radius: 5px;
+ background-color: rgba(0, 0, 0, 0.15);
opacity: 0;
- transition: opacity 0.15s ease;
- position: relative;
+ transition: opacity 0.15s ease, height 0.2s ease;
+ box-sizing: border-box;
}
-.board-drop-indicator.show {
- opacity: 0.8;
+.board-drop-placeholder.show {
+ opacity: 0.6;
}
.column-drop-indicator {
diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsx
index ec9d18c7be..1fa651f946 100644
--- a/apps/client/src/widgets/collections/board/index.tsx
+++ b/apps/client/src/widgets/collections/board/index.tsx
@@ -208,15 +208,11 @@ function Column({
const showIndicatorBefore = dropPosition?.column === column &&
dropPosition.index === index &&
draggedCard?.noteId !== note.noteId;
- const shouldShift = dropPosition?.column === column &&
- dropPosition.index <= index &&
- draggedCard?.noteId !== note.noteId &&
- draggedCard !== null;
return (
<>
{showIndicatorBefore && (
- <div className="board-drop-indicator show" />
+ <div className="board-drop-placeholder show" />
)}
<Card
note={note}
@@ -225,13 +221,12 @@ function Column({
index={index}
setDraggedCard={setDraggedCard}
isDragging={draggedCard?.noteId === note.noteId}
- shouldShift={shouldShift}
/>
</>
);
})}
{dropPosition?.column === column && dropPosition.index === (columnItems?.length ?? 0) && (
- <div className="board-drop-indicator show" />
+ <div className="board-drop-placeholder show" />
)}
<div className="board-new-item" onClick={() => createNewItem(parentNote, column)}>
@@ -248,16 +243,14 @@ function Card({
column,
index,
setDraggedCard,
- isDragging,
- shouldShift
+ isDragging
}: {
note: FNote,
branch: FBranch,
column: string,
index: number,
setDraggedCard: (card: { noteId: string, branchId: string, fromColumn: string, index: number } | null) => void,
- isDragging: boolean,
- shouldShift?: boolean
+ isDragging: boolean
}) {
const colorClass = note.getColorClass() || '';
@@ -273,7 +266,7 @@ function Card({
return (
<div
- className={`board-note ${colorClass} ${isDragging ? 'dragging' : ''} ${shouldShift ? 'shift-down' : ''}`}
+ className={`board-note ${colorClass} ${isDragging ? 'dragging' : ''}`}
draggable="true"
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}