Skip to content

Commit d313b92

Browse files
committed
Style tab controls and hide scrollbars
1 parent 1b44d90 commit d313b92

1 file changed

Lines changed: 30 additions & 21 deletions

File tree

components/DocumentTabs.tsx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
22
import type { DocumentOrFolder } from '../types';
33
import ContextMenu, { MenuItem } from './ContextMenu';
44
import { CloseIcon, ChevronDownIcon, FileIcon } from './Icons';
5+
import IconButton from './IconButton';
56

67
interface DocumentTabsProps {
78
documents: DocumentOrFolder[];
@@ -326,45 +327,53 @@ const DocumentTabs: React.FC<DocumentTabsProps> = ({
326327
return (
327328
<div className="border-b border-border-color bg-secondary/70 h-7 flex items-center">
328329
<div className="flex items-center gap-1 px-2 w-full h-full">
329-
<div
330-
ref={scrollContainerRef}
331-
className="flex-1 h-full overflow-x-auto overflow-y-hidden scrollbar-hidden"
332-
onDragOver={handleDragOver}
333-
onDrop={handleContainerDrop}
334-
role="tablist"
335-
>
336-
<div className="flex items-stretch gap-1 h-full min-w-max pr-2">
337-
{tabElements}
330+
<div className="flex-1 h-full relative overflow-hidden">
331+
<div
332+
ref={scrollContainerRef}
333+
className="absolute inset-y-0 left-0 right-0 overflow-x-auto overflow-y-hidden scrollbar-hidden"
334+
onDragOver={handleDragOver}
335+
onDrop={handleContainerDrop}
336+
role="tablist"
337+
>
338+
<div className="flex items-stretch gap-1 h-full min-w-max pr-2">
339+
{tabElements}
340+
</div>
338341
</div>
339342
</div>
340343
<div className="flex items-center gap-1">
341-
<button
342-
type="button"
343-
className="flex items-center justify-center w-7 h-7 rounded-md bg-secondary text-text-secondary hover:text-text-main hover:bg-secondary/80 border border-border-color/70 disabled:opacity-40 disabled:cursor-default"
344+
<IconButton
344345
onClick={() => scrollToDirection('left')}
346+
tooltip="Scroll tabs left"
345347
aria-label="Scroll tabs left"
348+
size="xs"
349+
variant="ghost"
346350
disabled={!scrollState.canScrollLeft}
351+
className="disabled:opacity-40 disabled:cursor-default"
347352
>
348353
<ChevronDownIcon className="w-4 h-4 -rotate-90" />
349-
</button>
350-
<button
351-
type="button"
352-
className="flex items-center justify-center w-7 h-7 rounded-md bg-secondary text-text-secondary hover:text-text-main hover:bg-secondary/80 border border-border-color/70 disabled:opacity-40 disabled:cursor-default"
354+
</IconButton>
355+
<IconButton
353356
onClick={() => scrollToDirection('right')}
357+
tooltip="Scroll tabs right"
354358
aria-label="Scroll tabs right"
359+
size="xs"
360+
variant="ghost"
355361
disabled={!scrollState.canScrollRight}
362+
className="disabled:opacity-40 disabled:cursor-default"
356363
>
357364
<ChevronDownIcon className="w-4 h-4 rotate-90" />
358-
</button>
359-
<button
360-
type="button"
361-
className="flex items-center justify-center w-7 h-7 rounded-md bg-secondary text-text-secondary hover:text-text-main hover:bg-secondary/80 border border-border-color/70 disabled:opacity-40 disabled:cursor-default"
365+
</IconButton>
366+
<IconButton
362367
onClick={openOverflowMenu}
368+
tooltip="Show hidden tabs"
363369
aria-label="Show hidden tabs"
370+
size="xs"
371+
variant="ghost"
364372
disabled={!scrollState.hiddenTabIds.length}
373+
className="disabled:opacity-40 disabled:cursor-default"
365374
>
366375
<ChevronDownIcon className="w-4 h-4" />
367-
</button>
376+
</IconButton>
368377
</div>
369378
</div>
370379
<ContextMenu

0 commit comments

Comments
 (0)