Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import DashboardWrapper from './DashboardWrapper';

// @z-index-above-dashboard-charts + 1 = 11
const FiltersPanel = styled.div<{ width: number; hidden: boolean }>`
background-color: ${({ theme }) => theme.colorBgContainer};
grid-column: 1;
grid-row: 1 / span 2;
z-index: 11;
Expand Down Expand Up @@ -275,6 +276,7 @@ const StyledDashboardContent = styled.div<{
marginLeft: number;
}>`
${({ theme, editMode, marginLeft }) => css`
background-color: ${theme.colorBgLayout};
display: flex;
flex-direction: row;
flex-wrap: nowrap;
Expand All @@ -286,14 +288,16 @@ const StyledDashboardContent = styled.div<{
padding-left: 0;
}

.grid-container .ant-tabs-nav {
padding-left: 0 !important;
Comment thread
gabotorresruiz marked this conversation as resolved.
Outdated
}

.grid-container {
/* without this, the grid will not get smaller upon toggling the builder panel on */
width: 0;
flex: 1;
position: relative;
margin-top: ${theme.sizeUnit * 4}px;
margin-right: ${theme.sizeUnit * 8}px;
margin-bottom: ${theme.sizeUnit * 4}px;
margin: ${theme.sizeUnit * 4}px;
Comment thread
gabotorresruiz marked this conversation as resolved.
margin-left: ${marginLeft}px;

${editMode &&
Expand Down Expand Up @@ -557,13 +561,10 @@ const DashboardBuilder = () => {
],
);

const dashboardContentMarginLeft =
!dashboardFiltersOpen &&
!editMode &&
nativeFiltersEnabled &&
filterBarOrientation !== FilterBarOrientation.Horizontal
? 0
: theme.sizeUnit * 8;
const dashboardContentMarginLeft = useMemo(
() => (!editMode ? theme.sizeUnit * 4 : theme.sizeUnit * 8),
[editMode, theme.sizeUnit],
);
Comment thread
gabotorresruiz marked this conversation as resolved.
Outdated

const renderChild = useCallback(
adjustedWidth => {
Expand Down Expand Up @@ -603,7 +604,7 @@ const DashboardBuilder = () => {
);

return (
<DashboardWrapper>
<DashboardWrapper dashboardFiltersOpen={dashboardFiltersOpen}>
{showFilterBar &&
filterBarOrientation === FilterBarOrientation.Vertical && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ afterAll(() => {

test('should render children', () => {
const { getByTestId } = render(
<DashboardWrapper>
<DashboardWrapper dashboardFiltersOpen={false}>
<div data-test="mock-children" />
</DashboardWrapper>,
{ useRedux: true, useDnd: true },
Expand All @@ -50,7 +50,7 @@ test('should update the style on dragging state', async () => {
index: 0,
};
const { container, getByText } = render(
<DashboardWrapper>
<DashboardWrapper dashboardFiltersOpen={false}>
<OptionControlLabel
{...defaultProps}
index={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { FC, useEffect, useState } from 'react';
import { FC, ReactNode, useEffect, useState } from 'react';

import { css, styled } from '@superset-ui/core';
import { Constants } from '@superset-ui/core/components';
Expand All @@ -26,8 +26,8 @@ import { useDragDropManager } from 'react-dnd';
import classNames from 'classnames';
import { debounce } from 'lodash';

const StyledDiv = styled.div`
${({ theme }) => css`
const StyledDiv = styled.div<{ dashboardFiltersOpen: boolean }>`
Comment thread
gabotorresruiz marked this conversation as resolved.
Outdated
${({ theme, dashboardFiltersOpen }) => css`
background-color: ${theme.colorBgLayout};
position: relative;
display: grid;
Expand Down Expand Up @@ -84,6 +84,12 @@ const StyledDiv = styled.div`
background: transparent;
}

.dashboard-component-tabs .ant-tabs-nav {
padding-left: ${dashboardFiltersOpen
? '0 !important'
Comment thread
gabotorresruiz marked this conversation as resolved.
Outdated
: `${theme.sizeUnit * 2}px`};
}

/* push Chart actions to upper right */
.dragdroppable-column .dashboard-component-chart-holder .hover-menu--top,
.dragdroppable .dashboard-component-header .hover-menu--top {
Expand Down Expand Up @@ -113,9 +119,12 @@ const StyledDiv = styled.div`
`}
`;

type Props = {};
type Props = {
children: ReactNode;
dashboardFiltersOpen: boolean;
};

const DashboardWrapper: FC<Props> = ({ children }) => {
const DashboardWrapper: FC<Props> = ({ children, dashboardFiltersOpen }) => {
Comment thread
gabotorresruiz marked this conversation as resolved.
Outdated
const editMode = useSelector<RootState, boolean>(
state => state.dashboardState.editMode,
);
Expand Down Expand Up @@ -150,6 +159,7 @@ const DashboardWrapper: FC<Props> = ({ children }) => {

return (
<StyledDiv
dashboardFiltersOpen={dashboardFiltersOpen}
className={classNames({
'dragdroppable--dragging': editMode && isDragged,
})}
Expand Down
Loading