diff --git a/packages/editor/src/components/InsSectionTitle.tsx b/packages/editor/src/components/InsSectionTitle.tsx index 3d487514..94058d1a 100644 --- a/packages/editor/src/components/InsSectionTitle.tsx +++ b/packages/editor/src/components/InsSectionTitle.tsx @@ -3,23 +3,39 @@ import {MaybeElement} from "@blueprintjs/core/src/common/props.ts"; import {Icon} from "@blueprintjs/core"; import React from "react"; +// `clip` and not `hidden`: a hidden box is a scroll container, and Chrome reserves a scrollbar width +// inside it, which opens a hole in the middle of the path. +const clip: React.CSSProperties = {minWidth: 0, overflow: "clip"} + +/** + * One line, at every panel width. The end of the title names the thing, so the folder in front of it + * is dimmed and gives up its width a hundred times faster. The whole title stays in the tooltip. + */ export function InsSectionTitle({title, icon}: { title: string, icon?: IconName | MaybeElement }) { + const nameAt = title.lastIndexOf('/') + 1 return
- {icon && (typeof icon === 'string' ? : icon)} + {icon && (typeof icon === 'string' ? : icon)} - {title} + {/* One flex item, so the row's gap never opens inside a path. */} + + {nameAt > 0 && + {title.slice(0, nameAt)} + } + {title.slice(nameAt)} +
; }