-
Notifications
You must be signed in to change notification settings - Fork 17.9k
fix: fix tabs overflow in dashboards #35984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,14 +96,14 @@ const StickyPanel = styled.div<{ width: number }>` | |
| `; | ||
|
|
||
| // @z-index-above-dashboard-popovers (99) + 1 = 100 | ||
| const StyledHeader = styled.div` | ||
| ${({ theme }) => css` | ||
| const StyledHeader = styled.div<{ filterBarWidth: number }>` | ||
| ${({ theme, filterBarWidth }) => css` | ||
| grid-column: 2; | ||
| grid-row: 1; | ||
| position: sticky; | ||
| top: 0; | ||
| z-index: 99; | ||
| max-width: 100vw; | ||
| max-width: calc(100vw - ${filterBarWidth}px); | ||
|
|
||
| .empty-droptarget:before { | ||
| position: absolute; | ||
|
|
@@ -426,6 +426,9 @@ const DashboardBuilder = () => { | |
| isReport; | ||
|
|
||
| const [barTopOffset, setBarTopOffset] = useState(0); | ||
| const [currentFilterBarWidth, setCurrentFilterBarWidth] = useState( | ||
| CLOSED_FILTER_BAR_WIDTH, | ||
| ); | ||
|
LevisNgigi marked this conversation as resolved.
|
||
|
|
||
| useEffect(() => { | ||
| setBarTopOffset(headerRef.current?.getBoundingClientRect()?.height || 0); | ||
|
|
@@ -523,6 +526,7 @@ const DashboardBuilder = () => { | |
| shouldFocus={shouldFocusTabs} | ||
| menuItems={[ | ||
| <IconButton | ||
| key="collapse-tabs" | ||
| icon={<Icons.FallOutlined iconSize="xl" />} | ||
| label={t('Collapse tab content')} | ||
| onClick={handleDeleteTopLevelTabs} | ||
|
|
@@ -566,6 +570,7 @@ const DashboardBuilder = () => { | |
| const filterBarWidth = dashboardFiltersOpen | ||
| ? adjustedWidth | ||
| : CLOSED_FILTER_BAR_WIDTH; | ||
| setCurrentFilterBarWidth(filterBarWidth); | ||
|
LevisNgigi marked this conversation as resolved.
Outdated
|
||
| return ( | ||
| <FiltersPanel | ||
| width={filterBarWidth} | ||
|
|
@@ -614,7 +619,16 @@ const DashboardBuilder = () => { | |
| </ResizableSidebar> | ||
| </> | ||
| )} | ||
| <StyledHeader ref={headerRef}> | ||
| <StyledHeader | ||
| data-test="dashboard-header-wrapper" | ||
| ref={headerRef} | ||
| filterBarWidth={ | ||
| showFilterBar && | ||
| filterBarOrientation === FilterBarOrientation.Vertical | ||
| ? currentFilterBarWidth | ||
| : 0 | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const filterBarWidth = useMemo(() => { Can we use variable like this outside and pass it here rather than putting ternary conditions here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I might be missing something, but I don’t see this modification in the code. Could you please double-check? |
||
| > | ||
| {/* @ts-ignore */} | ||
| <Droppable | ||
| data-test="top-level-tabs" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.