Skip to content

Commit 97649d7

Browse files
msyavuzsadpandajoe
authored andcommitted
fix(BuilderComponentPane): navigation tabs padding (#35213)
(cherry picked from commit 7a9dbfe)
1 parent df0f6f6 commit 97649d7

File tree

1 file changed

+69
-86
lines changed
  • superset-frontend/src/dashboard/components/BuilderComponentPane

1 file changed

+69
-86
lines changed

superset-frontend/src/dashboard/components/BuilderComponentPane/index.tsx

Lines changed: 69 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
/* eslint-env browser */
2020
import tinycolor from 'tinycolor2';
2121
import Tabs from '@superset-ui/core/components/Tabs';
22-
import { t, css, SupersetTheme, useTheme } from '@superset-ui/core';
23-
import { useSelector } from 'react-redux';
22+
import { t, css, SupersetTheme } from '@superset-ui/core';
2423
import SliceAdder from 'src/dashboard/containers/SliceAdder';
2524
import dashboardComponents from 'src/visualizations/presets/dashboardComponents';
26-
import { useMemo } from 'react';
2725
import NewColumn from '../gridComponents/new/NewColumn';
2826
import NewDivider from '../gridComponents/new/NewDivider';
2927
import NewHeader from '../gridComponents/new/NewHeader';
@@ -39,98 +37,83 @@ const TABS_KEYS = {
3937
LAYOUT_ELEMENTS: 'LAYOUT_ELEMENTS',
4038
};
4139

42-
const BuilderComponentPane = ({ topOffset = 0 }) => {
43-
const theme = useTheme();
44-
const nativeFiltersBarOpen = useSelector(
45-
(state: any) => state.dashboardState.nativeFiltersBarOpen ?? false,
46-
);
47-
48-
const tabBarStyle = useMemo(
49-
() => ({
50-
paddingLeft: nativeFiltersBarOpen ? 0 : theme.sizeUnit * 4,
51-
}),
52-
[nativeFiltersBarOpen, theme.sizeUnit],
53-
);
54-
55-
return (
40+
const BuilderComponentPane = ({ topOffset = 0 }) => (
41+
<div
42+
data-test="dashboard-builder-sidepane"
43+
css={css`
44+
position: sticky;
45+
right: 0;
46+
top: ${topOffset}px;
47+
height: calc(100vh - ${topOffset}px);
48+
width: ${BUILDER_PANE_WIDTH}px;
49+
`}
50+
>
5651
<div
57-
data-test="dashboard-builder-sidepane"
58-
css={css`
59-
position: sticky;
60-
right: 0;
61-
top: ${topOffset}px;
62-
height: calc(100vh - ${topOffset}px);
52+
css={(theme: SupersetTheme) => css`
53+
position: absolute;
54+
height: 100%;
6355
width: ${BUILDER_PANE_WIDTH}px;
56+
box-shadow: -${theme.sizeUnit}px 0 ${theme.sizeUnit}px 0
57+
${tinycolor(theme.colorBorder).setAlpha(0.1).toRgbString()};
58+
background-color: ${theme.colorBgBase};
6459
`}
6560
>
66-
<div
61+
<Tabs
62+
data-test="dashboard-builder-component-pane-tabs-navigation"
63+
id="tabs"
6764
css={(theme: SupersetTheme) => css`
68-
position: absolute;
65+
line-height: inherit;
66+
margin-top: ${theme.sizeUnit * 2}px;
6967
height: 100%;
70-
width: ${BUILDER_PANE_WIDTH}px;
71-
box-shadow: -4px 0 4px 0
72-
${tinycolor(theme.colorBorder).setAlpha(0.1).toRgbString()};
73-
background-color: ${theme.colorBgBase};
74-
`}
75-
>
76-
<Tabs
77-
data-test="dashboard-builder-component-pane-tabs-navigation"
78-
id="tabs"
79-
tabBarStyle={tabBarStyle}
80-
css={(theme: SupersetTheme) => css`
81-
line-height: inherit;
82-
margin-top: ${theme.sizeUnit * 2}px;
83-
height: 100%;
8468
85-
& .ant-tabs-content-holder {
69+
& .ant-tabs-content-holder {
70+
height: 100%;
71+
& .ant-tabs-content {
8672
height: 100%;
87-
& .ant-tabs-content {
88-
height: 100%;
89-
}
9073
}
91-
`}
92-
items={[
93-
{
94-
key: TABS_KEYS.CHARTS,
95-
label: t('Charts'),
96-
children: (
97-
<div
98-
css={css`
99-
height: calc(100vh - ${topOffset * 2}px);
100-
`}
101-
>
102-
<SliceAdder />
103-
</div>
104-
),
105-
},
106-
{
107-
key: TABS_KEYS.LAYOUT_ELEMENTS,
108-
label: t('Layout elements'),
109-
children: (
110-
<>
111-
<NewTabs />
112-
<NewRow />
113-
<NewColumn />
114-
<NewHeader />
115-
<NewMarkdown />
116-
<NewDivider />
117-
{dashboardComponents
118-
.getAll()
119-
.map(({ key: componentKey, metadata }) => (
120-
<NewDynamicComponent
121-
key={componentKey}
122-
metadata={metadata}
123-
componentKey={componentKey}
124-
/>
125-
))}
126-
</>
127-
),
128-
},
129-
]}
130-
/>
131-
</div>
74+
}
75+
`}
76+
items={[
77+
{
78+
key: TABS_KEYS.CHARTS,
79+
label: t('Charts'),
80+
children: (
81+
<div
82+
css={css`
83+
height: calc(100vh - ${topOffset * 2}px);
84+
`}
85+
>
86+
<SliceAdder />
87+
</div>
88+
),
89+
},
90+
{
91+
key: TABS_KEYS.LAYOUT_ELEMENTS,
92+
label: t('Layout elements'),
93+
children: (
94+
<>
95+
<NewTabs />
96+
<NewRow />
97+
<NewColumn />
98+
<NewHeader />
99+
<NewMarkdown />
100+
<NewDivider />
101+
{dashboardComponents
102+
.getAll()
103+
.map(({ key: componentKey, metadata }) => (
104+
<NewDynamicComponent
105+
key={componentKey}
106+
metadata={metadata}
107+
componentKey={componentKey}
108+
/>
109+
))}
110+
</>
111+
),
112+
},
113+
]}
114+
/>
132115
</div>
133-
);
134-
};
116+
</div>
117+
);
135118

136119
export default BuilderComponentPane;

0 commit comments

Comments
 (0)