@@ -13,11 +13,12 @@ import {
1313 EuiFlexGroup ,
1414 EuiFlexItem ,
1515 EuiButtonGroup ,
16- EuiFormLabel ,
16+ EuiFormRow ,
1717 EuiFlyoutHeader ,
1818 EuiTitle ,
1919 EuiFlyoutBody ,
2020 EuiSpacer ,
21+ EuiSwitch ,
2122} from '@elastic/eui' ;
2223
2324import { ControlsPanels } from '../types' ;
@@ -29,6 +30,7 @@ interface ManageControlGroupProps {
2930 panels : ControlsPanels ;
3031 controlStyle : ControlStyle ;
3132 deleteAllEmbeddables : ( ) => void ;
33+ onClose : ( ) => void ;
3234 setControlStyle : ( style : ControlStyle ) => void ;
3335 setAllPanelWidths : ( newWidth : ControlWidth ) => void ;
3436}
@@ -37,11 +39,13 @@ export const ManageControlGroup = ({
3739 panels,
3840 controlStyle,
3941 setControlStyle,
42+ onClose,
4043 setAllPanelWidths,
4144 deleteAllEmbeddables,
4245} : ManageControlGroupProps ) => {
4346 const [ currentControlStyle , setCurrentControlStyle ] = useState < ControlStyle > ( controlStyle ) ;
4447 const [ selectedWidth , setSelectedWidth ] = useState < ControlWidth > ( ) ;
48+ const [ selectionDisplay , setSelectionDisplay ] = useState ( false ) ;
4549
4650 useMount ( ( ) => {
4751 if ( ! panels || Object . keys ( panels ) . length === 0 ) return ;
@@ -59,55 +63,54 @@ export const ManageControlGroup = ({
5963 </ EuiTitle >
6064 </ EuiFlyoutHeader >
6165 < EuiFlyoutBody >
62- < EuiTitle size = "s" >
63- < h3 > { ControlGroupStrings . management . getDesignTitle ( ) } </ h3 >
64- </ EuiTitle >
65- < EuiSpacer size = "s" />
66- < EuiButtonGroup
67- legend = { ControlGroupStrings . management . controlStyle . getDesignSwitchLegend ( ) }
68- options = { CONTROL_LAYOUT_OPTIONS }
69- idSelected = { currentControlStyle }
70- onChange = { ( newControlStyle ) => {
71- setControlStyle ( newControlStyle as ControlStyle ) ;
72- setCurrentControlStyle ( newControlStyle as ControlStyle ) ;
73- } }
74- />
66+ < EuiFormRow label = { ControlGroupStrings . management . getLayoutTitle ( ) } >
67+ < EuiButtonGroup
68+ color = "primary"
69+ legend = { ControlGroupStrings . management . controlStyle . getDesignSwitchLegend ( ) }
70+ options = { CONTROL_LAYOUT_OPTIONS }
71+ idSelected = { currentControlStyle }
72+ onChange = { ( newControlStyle ) => {
73+ setControlStyle ( newControlStyle as ControlStyle ) ;
74+ setCurrentControlStyle ( newControlStyle as ControlStyle ) ;
75+ } }
76+ />
77+ </ EuiFormRow >
7578 < EuiSpacer size = "m" />
76- < EuiTitle size = "s" >
77- < h3 > { ControlGroupStrings . management . getLayoutTitle ( ) } </ h3 >
78- </ EuiTitle >
79- < EuiSpacer size = "s" />
80-
81- < EuiFlexGroup alignItems = "center" justifyContent = "flexEnd" >
82- < EuiFlexItem grow = { false } >
83- < EuiFormLabel >
84- { ControlGroupStrings . management . controlWidth . getChangeAllControlWidthsTitle ( ) }
85- </ EuiFormLabel >
86- </ EuiFlexItem >
87- < EuiFlexItem grow = { false } >
79+ < EuiFormRow label = { ControlGroupStrings . management . getWidthTitle ( ) } >
80+ < EuiSwitch
81+ label = { ControlGroupStrings . management . controlWidth . getChangeAllControlWidthsTitle ( ) }
82+ checked = { selectionDisplay }
83+ onChange = { ( ) => setSelectionDisplay ( ! selectionDisplay ) }
84+ />
85+ </ EuiFormRow >
86+ { selectionDisplay ? (
87+ < >
88+ < EuiSpacer size = "s" />
8889 < EuiButtonGroup
90+ color = "primary"
8991 idSelected = { selectedWidth ?? '' }
90- buttonSize = "compressed"
9192 legend = { ControlGroupStrings . management . controlWidth . getWidthSwitchLegend ( ) }
9293 options = { CONTROL_WIDTH_OPTIONS }
9394 onChange = { ( newWidth : string ) => {
9495 setAllPanelWidths ( newWidth as ControlWidth ) ;
9596 setSelectedWidth ( newWidth as ControlWidth ) ;
9697 } }
9798 />
98- </ EuiFlexItem >
99- < EuiFlexItem grow = { false } >
100- < EuiButtonEmpty
101- onClick = { deleteAllEmbeddables }
102- aria-label = { 'delete-all' }
103- iconType = "trash"
104- color = "danger"
105- size = "s"
106- >
107- { ControlGroupStrings . management . getDeleteAllButtonTitle ( ) }
108- </ EuiButtonEmpty >
109- </ EuiFlexItem >
110- </ EuiFlexGroup >
99+ </ >
100+ ) : undefined }
101+
102+ < EuiSpacer size = "xl" />
103+
104+ < EuiButtonEmpty
105+ onClick = { deleteAllEmbeddables }
106+ aria-label = { 'delete-all' }
107+ iconType = "trash"
108+ flush = "left"
109+ color = "danger"
110+ size = "s"
111+ >
112+ { ControlGroupStrings . management . getDeleteAllButtonTitle ( ) }
113+ </ EuiButtonEmpty >
111114 </ EuiFlyoutBody >
112115 </ >
113116 ) ;
0 commit comments