From f9c7c960d524f1818ba58c814cb289164c0f35bb Mon Sep 17 00:00:00 2001 From: th-kim0823 Date: Fri, 15 May 2026 15:10:35 +0900 Subject: [PATCH] =?UTF-8?q?feat(notebook):=20NotebookList=20=EC=9D=98=20ho?= =?UTF-8?q?ver=20=E2=86=91=E2=86=93=20=EB=B2=84=ED=8A=BC=20+=20reorder=20a?= =?UTF-8?q?ction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inbox/components/NotebookList.tsx | 70 +++++++++++++------ src/renderer/inbox/components/Sidebar.tsx | 2 + src/renderer/inbox/store.ts | 7 ++ tests/unit/NotebookList.test.tsx | 28 ++++++++ tests/unit/store.notebook.test.ts | 16 ++++- 5 files changed, 100 insertions(+), 23 deletions(-) diff --git a/src/renderer/inbox/components/NotebookList.tsx b/src/renderer/inbox/components/NotebookList.tsx index 19091a6..ddb2886 100644 --- a/src/renderer/inbox/components/NotebookList.tsx +++ b/src/renderer/inbox/components/NotebookList.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import type { Notebook } from '@shared/types'; interface Props { @@ -6,33 +6,63 @@ interface Props { selectedId: string | null; onSelect: (id: string) => void; onCreate: () => void; + onReorder?: (id: string, direction: 'up' | 'down') => Promise; } -export function NotebookList({ notebooks, selectedId, onSelect, onCreate }: Props): React.ReactElement { +export function NotebookList({ notebooks, selectedId, onSelect, onCreate, onReorder }: Props): React.ReactElement { + const [hoverId, setHoverId] = useState(null); + return (
- {notebooks.map((nb) => { + {notebooks.map((nb, idx) => { const active = nb.id === selectedId; + const hover = nb.id === hoverId; + const isFirst = idx === 0; + const isLast = idx === notebooks.length - 1; return ( - + + {hover && onReorder && notebooks.length > 1 && ( +
+ + +
+ )} +
); })}