mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: resolve outsideBox style for tabs (#24561)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.
Fixes the `outsideBox` variant styling for tabs and simplifies the kebab
overflow logic. The overflow calculation now accounts for `column-gap`
between tabs so the menu trigger appears at the correct breakpoint.
- Fix Tailwind hover selector syntax for `outsideBox` variant
(`[&_[data-slot=tabs-trigger]:hover]` instead of
`[&_[data-slot=tabs-trigger]]:hover`)
- Account for `column-gap` in `useKebabMenu` overflow calculation via a
new `getTabGap` helper
- Use content-box width (`getContentBoxWidth`) for the initial overflow
pass so it matches `ResizeObserver`'s `contentRect.width`
- Consolidate `calculateTabValues` into a single-pass loop, removing the
separate `findFirstTabIndex` function
- Drop `FC` wrapper in favor of inline prop destructuring across all tab
components
- Forward `ref` through `TabsList` so consumers can attach refs directly
- Add `useKebabMenu` unit tests covering both all-visible and overflow
scenarios
This commit is contained in:
@@ -2,6 +2,7 @@ import Collapse from "@mui/material/Collapse";
|
||||
import {
|
||||
CopyIcon,
|
||||
EllipsisIcon,
|
||||
PackageIcon,
|
||||
PlayIcon,
|
||||
SquareCheckBigIcon,
|
||||
TriangleAlertIcon,
|
||||
@@ -280,6 +281,7 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
{
|
||||
title: "All Logs",
|
||||
value: "all",
|
||||
startIcon: <PackageIcon className="size-icon-xs shrink-0" />,
|
||||
},
|
||||
...(startupScriptLogTab ? [startupScriptLogTab] : []),
|
||||
...sortedSourceLogTabs,
|
||||
@@ -535,11 +537,13 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
onValueChange={setSelectedLogTab}
|
||||
>
|
||||
<div className="flex items-stretch">
|
||||
<div
|
||||
ref={logTabsListContainerRef}
|
||||
className="min-w-0 flex-1 overflow-hidden"
|
||||
>
|
||||
<TabsList variant="insideBox" overflowKebabMenu>
|
||||
<div className="min-w-0 flex-1 overflow-hidden">
|
||||
<TabsList
|
||||
variant="outsideBox"
|
||||
overflowKebabMenu
|
||||
ref={logTabsListContainerRef}
|
||||
className="px-4"
|
||||
>
|
||||
{visibleLogTabs.map((tab) => (
|
||||
<TabsTrigger
|
||||
key={tab.value}
|
||||
@@ -565,7 +569,12 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
: "inactive"
|
||||
}
|
||||
aria-label="More log tabs"
|
||||
className="border-none py-4 bg-transparent text-inherit inline-flex items-center justify-center cursor-pointer transition-colors duration-150 ease-linear"
|
||||
className={cn(
|
||||
"cursor-pointer -mb-px",
|
||||
"inline-flex items-center justify-center",
|
||||
"border-none py-3 bg-transparent text-inherit",
|
||||
"transition-colors duration-150 ease-linear",
|
||||
)}
|
||||
>
|
||||
<EllipsisIcon className="size-icon-sm" />
|
||||
<span className="sr-only">More log tabs</span>
|
||||
|
||||
Reference in New Issue
Block a user