@@ -56,6 +56,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
56
56
const [ flexDir , setFlexDir ] = useState ( '' ) ;
57
57
const [ flexJustify , setFlexJustify ] = useState ( '' ) ;
58
58
const [ flexAlign , setFlexAlign ] = useState ( '' ) ;
59
+ const [ flexOptionsVisible , setFlexOptionsVisible ] = useState ( false ) ;
59
60
const [ BGColor , setBGColor ] = useState ( '' ) ;
60
61
const [ compText , setCompText ] = useState ( '' ) ;
61
62
const [ compLink , setCompLink ] = useState ( '' ) ;
@@ -69,7 +70,9 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
69
70
const [ useContextObj , setUseContextObj ] = useState ( { } ) ;
70
71
const [ stateUsedObj , setStateUsedObj ] = useState ( { } ) ;
71
72
const [ eventAll , setEventAll ] = useState ( [ '' , '' ] ) ;
73
+ const [ eventOptionsVisible , setEventOptionsVisible ] = useState ( false ) ;
72
74
const [ eventRow , setEventRow ] = useState ( [ ] ) ;
75
+ const [ eventRowsVisible , setEventRowsVisible ] = useState ( false ) ;
73
76
74
77
const currFocus = getFocus ( ) . child ;
75
78
@@ -86,6 +89,35 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
86
89
}
87
90
} , [ state ] ) ;
88
91
92
+ useEffect ( ( ) => {
93
+ if ( displayMode === 'flex' ) {
94
+ return setFlexOptionsVisible ( true ) ;
95
+ }
96
+ return setFlexOptionsVisible ( false ) ;
97
+ } , [ displayMode ] ) ;
98
+
99
+ useEffect ( ( ) => {
100
+ if ( eventAll [ 0 ] !== '' ) {
101
+ return setEventOptionsVisible ( true ) ;
102
+ }
103
+ return setEventOptionsVisible ( false ) ;
104
+ } , [ eventAll ] ) ;
105
+
106
+ useEffect ( ( ) => {
107
+ if ( eventRow . length ) {
108
+ return setEventRowsVisible ( true ) ;
109
+ }
110
+ return setEventRowsVisible ( false ) ;
111
+ } , [ eventRow ] ) ;
112
+
113
+ const marginTopAmount = ( ) => {
114
+ let totalMargin = 0 ;
115
+ if ( eventOptionsVisible ) totalMargin += 90 ;
116
+ if ( flexOptionsVisible ) totalMargin = Math . max ( totalMargin , 210 ) ;
117
+ if ( eventRowsVisible ) totalMargin = Math . max ( totalMargin , 335 ) ;
118
+ return `${ totalMargin } px` ;
119
+ } ;
120
+
89
121
//this function allows properties to persist and appear in nested divs
90
122
function deepIterate ( arr ) {
91
123
const output = [ ] ;
@@ -128,7 +160,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
128
160
resetFields ( ) ;
129
161
} , [ state . canvasFocus . componentId , state . canvasFocus . childId ] ) ;
130
162
// handles all input field changes, with specific updates called based on input's name
131
- const handleChange = ( e : React . ChangeEvent < { value : any } > ) => {
163
+ const handleChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
132
164
const inputVal = e . target . value ;
133
165
switch ( e . target . name ) {
134
166
case 'display' :
@@ -862,7 +894,10 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
862
894
) }
863
895
</ div >
864
896
</ section >
865
- < div className = { classes . buttonRow } >
897
+ < div
898
+ className = { classes . buttonRow }
899
+ style = { { marginTop : marginTopAmount ( ) } }
900
+ >
866
901
< div >
867
902
< Button
868
903
variant = "contained"
@@ -957,7 +992,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
957
992
</ Button >
958
993
</ div >
959
994
) }
960
- < div style = { { marginLeft : '17px' } } >
995
+ < div style = { { marginLeft : '17px' } } >
961
996
< Button
962
997
variant = "contained"
963
998
color = "primary"
@@ -1039,6 +1074,7 @@ const useStyles = makeStyles({
1039
1074
justifyContent : 'center' ,
1040
1075
alignItems : 'center' ,
1041
1076
textAlign : 'center' ,
1077
+ marginLeft : '15px' ,
1042
1078
'& > .MuiButton-textSecondary' : {
1043
1079
color : isThemeLight ? '#808080' : '#ECECEA' , // color for delete page
1044
1080
border : isThemeLight ? '1px solid #808080' : '1px solid #ECECEA'
0 commit comments