import React, { useState } from 'react'; import type { Notebook } from '@shared/types'; interface Props { notebooks: Notebook[]; selectedId: string | null; onSelect: (id: string) => void; onCreate: () => void; onReorder?: (id: string, direction: 'up' | 'down') => Promise; } export function NotebookList({ notebooks, selectedId, onSelect, onCreate, onReorder }: Props): React.ReactElement { const [hoverId, setHoverId] = useState(null); return (
{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 (
setHoverId(nb.id)} onMouseLeave={() => setHoverId(null)} style={{ position: 'relative', display: 'flex' }} > {hover && onReorder && notebooks.length > 1 && (
)}
); })}
); }