fix: improve BreadcrumbTrail truncation and layout within flexible panel headers by adjusting CSS and width calculation constants.
This commit is contained in:
@@ -3,5 +3,5 @@ export const DEFAULT_VIEWPORT_MARGIN = 8;
|
|||||||
|
|
||||||
export const ELLIPSIS = { id: '__breadcrumbs_ellipsis__', label: '…', onClick: null, raw: null } as const;
|
export const ELLIPSIS = { id: '__breadcrumbs_ellipsis__', label: '…', onClick: null, raw: null } as const;
|
||||||
export const WIDTH_TOLERANCE = 1;
|
export const WIDTH_TOLERANCE = 1;
|
||||||
export const WIDTH_BUFFER_RATIO = 0.95;
|
export const WIDTH_BUFFER_RATIO = 0.99;
|
||||||
export const WIDTH_CHANGE_TOLERANCE = 0.25;
|
export const WIDTH_CHANGE_TOLERANCE = 0.02;
|
||||||
|
|||||||
@@ -437,12 +437,14 @@ const DocumentViewerPanel: React.FC<DocumentViewerPanelProps> = ({
|
|||||||
) : loadingSection;
|
) : loadingSection;
|
||||||
|
|
||||||
const headerTitle = breadcrumbTrailEntries.length ? (
|
const headerTitle = breadcrumbTrailEntries.length ? (
|
||||||
|
<div className="panel-header__breadcrumbs-wrapper">
|
||||||
<BreadcrumbTrail
|
<BreadcrumbTrail
|
||||||
entries={breadcrumbTrailEntries}
|
entries={breadcrumbTrailEntries}
|
||||||
separator="/"
|
separator="/"
|
||||||
className="panel-header__breadcrumbs"
|
className="panel-header__breadcrumbs"
|
||||||
truncateFromStart={isSidebarVariant}
|
truncateFromStart={isSidebarVariant}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
document?.title || 'Document preview'
|
document?.title || 'Document preview'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb-trail__link {
|
.breadcrumb-trail__link {
|
||||||
display: inline-flex;
|
display: block;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@@ -83,6 +83,7 @@
|
|||||||
font: inherit;
|
font: inherit;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb-trail--measure .breadcrumb-trail__link,
|
.breadcrumb-trail--measure .breadcrumb-trail__link,
|
||||||
@@ -138,6 +139,11 @@ button.breadcrumb-trail__link,
|
|||||||
max-width: 22rem;
|
max-width: 22rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panel-header__breadcrumbs-wrapper {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
.panel-section__body {
|
.panel-section__body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ const BreadcrumbTrail = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reserve a tiny buffer so the live trail doesn't oscillate when the
|
// Reserve a tiny buffer so the live trail doesn't oscillate when the
|
||||||
// container width barely fits; shrink the measured allowance by 1%.
|
// container width barely fits; shrink the measured allowance a bit.
|
||||||
const adjustedAvailable = available * WIDTH_BUFFER_RATIO;
|
const adjustedAvailable = available * WIDTH_BUFFER_RATIO;
|
||||||
|
|
||||||
let nextStart = widths.length - 1;
|
let nextStart = widths.length - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user