19
19
/* eslint-env browser */
20
20
import tinycolor from 'tinycolor2' ;
21
21
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' ;
24
23
import SliceAdder from 'src/dashboard/containers/SliceAdder' ;
25
24
import dashboardComponents from 'src/visualizations/presets/dashboardComponents' ;
26
- import { useMemo } from 'react' ;
27
25
import NewColumn from '../gridComponents/new/NewColumn' ;
28
26
import NewDivider from '../gridComponents/new/NewDivider' ;
29
27
import NewHeader from '../gridComponents/new/NewHeader' ;
@@ -39,98 +37,83 @@ const TABS_KEYS = {
39
37
LAYOUT_ELEMENTS : 'LAYOUT_ELEMENTS' ,
40
38
} ;
41
39
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
+ >
56
51
< 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% ;
63
55
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 } ;
64
59
` }
65
60
>
66
- < div
61
+ < Tabs
62
+ data-test = "dashboard-builder-component-pane-tabs-navigation"
63
+ id = "tabs"
67
64
css = { ( theme : SupersetTheme ) => css `
68
- position : absolute;
65
+ line-height : inherit;
66
+ margin-top : ${ theme . sizeUnit * 2 } px;
69
67
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% ;
84
68
85
- & .ant-tabs-content-holder {
69
+ & .ant-tabs-content-holder {
70
+ height : 100% ;
71
+ & .ant-tabs-content {
86
72
height : 100% ;
87
- & .ant-tabs-content {
88
- height : 100% ;
89
- }
90
73
}
91
- ` }
92
- items = { [
93
- {
94
- key : TABS_KEYS . CHARTS ,
95
- label : t ( 'Charts' ) ,
96
- children : (
97
- < div
98
- css = { css `
99
- height : calc ( 100 vh - ${ 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 ( 100 vh - ${ 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
+ / >
132
115
</ div >
133
- ) ;
134
- } ;
116
+ </ div >
117
+ ) ;
135
118
136
119
export default BuilderComponentPane ;
0 commit comments