diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx index 807fe46b75de..ba18e537e375 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx @@ -55,6 +55,7 @@ import DashboardContainer from './DashboardContainer'; const TABS_HEIGHT = 47; const HEADER_HEIGHT = 67; +const NATIVE_FILTER_BAR_WIDTH = 255; type DashboardBuilderProps = {}; @@ -161,6 +162,11 @@ const DashboardBuilder: FC = () => { (hideDashboardHeader ? 0 : HEADER_HEIGHT) + (topLevelTabs ? TABS_HEIGHT : 0); + const tabsPaddingLeft = + nativeFiltersEnabled && !editMode && dashboardFiltersOpen + ? NATIVE_FILTER_BAR_WIDTH + 20 + : 8; + useEffect(() => { if ( filterValues.length === 0 && @@ -219,6 +225,7 @@ const DashboardBuilder: FC = () => { renderTabContent={false} renderHoverMenu={false} onChangeTab={handleChangeTab} + paddingLeft={tabsPaddingLeft} /> )} @@ -235,9 +242,11 @@ const DashboardBuilder: FC = () => { ` position: relative; width: ${({ theme }) => theme.gridUnit * 8}px; flex: 0 0 ${({ theme }) => theme.gridUnit * 8}px; @@ -33,7 +33,7 @@ const Wrapper = styled.div` transition-delay: ${({ theme }) => theme.transitionTiming * 2}s; } */ &.open { - width: 250px; + width: ${({ openWidth }) => openWidth}px; flex: 0 0 250px; /* &.animated { transition-delay: 0s; @@ -50,7 +50,7 @@ const Contents = styled.div` export interface SVBProps { topOffset: number; - width?: number; + openWidth: number; filtersOpen: boolean; } @@ -65,8 +65,9 @@ export const StickyVerticalBar: React.FC = ({ topOffset, children, filtersOpen, + openWidth, }) => ( - + {({ @@ -79,6 +80,7 @@ export const StickyVerticalBar: React.FC = ({ distanceFromTop: number; }) => ( theme.colors.grayscale.light5}; + &.dashboard-component.dashboard-component-tabs { + padding-left: ${({ paddingLeft }) => paddingLeft}px; + } + .dashboard-component-tabs-content { min-height: ${({ theme }) => theme.gridUnit * 12}px; margin-top: ${({ theme }) => theme.gridUnit / 4}px; @@ -276,6 +282,7 @@ class Tabs extends React.PureComponent { dashboardLayout, lastFocusedTabId, setLastFocusedTab, + paddingLeft, } = this.props; const { children: tabIds } = tabsComponent; @@ -311,6 +318,7 @@ class Tabs extends React.PureComponent { {editMode && renderHoverMenu && ( diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.test.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.test.tsx index d666c975fa5e..30f766e5b049 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.test.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.test.tsx @@ -208,7 +208,7 @@ describe('FilterBar', () => { const renderWrapper = (props = closedBarProps, state?: object) => render( - + , ); diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx index 44a4f82aed72..abfaf51b57a4 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx @@ -50,22 +50,20 @@ import EditSection from './FilterSets/EditSection'; import Header from './Header'; import FilterControls from './FilterControls/FilterControls'; -const BAR_WIDTH = `250px`; - export const FILTER_BAR_TEST_ID = 'filter-bar'; export const getFilterBarTestId = testWithId(FILTER_BAR_TEST_ID); -const BarWrapper = styled.div` +const BarWrapper = styled.div<{ width: number }>` width: ${({ theme }) => theme.gridUnit * 8}px; & .ant-tabs-top > .ant-tabs-nav { margin: 0; } &.open { - width: ${BAR_WIDTH}; // arbitrary... + min-width: ${({ width }) => width}px; // arbitrary... } `; -const Bar = styled.div` +const Bar = styled.div<{ width: number }>` & .ant-typography-edit-content { left: 0; margin-top: 0; @@ -76,7 +74,7 @@ const Bar = styled.div` left: 0; flex-direction: column; flex-grow: 1; - width: ${BAR_WIDTH}; // arbitrary... + min-width: ${({ width }) => width}px; // arbitrary... background: ${({ theme }) => theme.colors.grayscale.light5}; border-right: 1px solid ${({ theme }) => theme.colors.grayscale.light2}; min-height: 100%; @@ -149,12 +147,14 @@ const StyledTabs = styled(Tabs)` `; export interface FiltersBarProps { + width: number; filtersOpen: boolean; toggleFiltersBar: any; directPathToChild?: string[]; } const FilterBar: React.FC = ({ + width, filtersOpen, toggleFiltersBar, directPathToChild, @@ -212,7 +212,11 @@ const FilterBar: React.FC = ({ const isInitialized = useInitialization(); return ( - + = ({ /> - +