From 9841031689d6a66a5949d43803faeb251fe471eb Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 1 Jan 2021 00:34:10 +0800 Subject: ... --- FrontEnd/src/app/views/home/TimelineBoard.tsx | 45 ++++++++++++++++++++++++--- FrontEnd/src/app/views/home/home.sass | 2 +- 2 files changed, 42 insertions(+), 5 deletions(-) (limited to 'FrontEnd/src') diff --git a/FrontEnd/src/app/views/home/TimelineBoard.tsx b/FrontEnd/src/app/views/home/TimelineBoard.tsx index a83095d4..b389309a 100644 --- a/FrontEnd/src/app/views/home/TimelineBoard.tsx +++ b/FrontEnd/src/app/views/home/TimelineBoard.tsx @@ -11,15 +11,23 @@ import { HttpTimelineInfo } from "@/http/timeline"; interface TimelineBoardItemProps { timeline: HttpTimelineInfo; + // In height. + offset?: number; + // In px. + arbitraryOffset?: number; // If not null, will disable navigation on click. actions?: { onDelete: () => void; - onMove: (e: React.PointerEvent) => void; + onMoveStart: (e: React.PointerEvent) => void; + onMoving: (e: React.PointerEvent) => void; + onMoveEnd: (e: React.PointerEvent) => void; }; } const TimelineBoardItem: React.FC = ({ timeline, + arbitraryOffset, + offset, actions, }) => { const { name, title } = timeline; @@ -42,18 +50,36 @@ const TimelineBoardItem: React.FC = ({ {actions != null ? (
- +
) : null} ); + const offsetStyle: React.CSSProperties = { + translate: + arbitraryOffset != null + ? `0 ${arbitraryOffset}px` + : offset != null + ? `0 ${offset * 100}%` + : undefined, + transition: + arbitraryOffset == null && offset != null ? "translate 0.5s" : undefined, + }; + return actions == null ? ( {content} ) : ( -
{content}
+
+ {content} +
); }; @@ -74,6 +100,11 @@ const TimelineBoardUI: React.FC = (props) => { const [editing, setEditing] = React.useState(false); + const [moveState, setMoveState] = React.useState(null); + return (
@@ -138,7 +169,13 @@ const TimelineBoardUI: React.FC = (props) => { onDelete: () => { //TODO: Implement this. }, - onMove: () => { + onMoveStart: () => { + //TODO: Implement this. + }, + onMoving: () => { + //TODO: Implement this. + }, + onMoveEnd: () => { //TODO: Implement this. }, } diff --git a/FrontEnd/src/app/views/home/home.sass b/FrontEnd/src/app/views/home/home.sass index 7694b50c..644eb550 100644 --- a/FrontEnd/src/app/views/home/home.sass +++ b/FrontEnd/src/app/views/home/home.sass @@ -14,7 +14,7 @@ .timeline-board-item font-size: 1.1em @extend .px-3 - @extend .py-2 + height: 48px transition: background 0.3s display: flex align-items: center -- cgit v1.2.3