5
5
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
6
*/
7
7
8
- import { Box , LinearProgress } from '@mui/material' ;
8
+ import { Box , Grid , LinearProgress , Theme } from '@mui/material' ;
9
9
import { ReactNode } from 'react' ;
10
10
import { UseLoadFlowParametersFormReturn } from './use-load-flow-parameters-form' ;
11
11
import LoadFlowParametersHeader from './load-flow-parameters-header' ;
@@ -18,6 +18,32 @@ interface LoadFlowParametersFormProps {
18
18
renderActions ?: ( ) => ReactNode ;
19
19
}
20
20
21
+ const styles = {
22
+ form : {
23
+ height : '100%' ,
24
+ display : 'flex' ,
25
+ position : 'relative' ,
26
+ flexDirection : 'column' ,
27
+ } ,
28
+ loadflowParameters : {
29
+ flexGrow : 1 ,
30
+ paddingLeft : 1 ,
31
+ overflow : 'auto' ,
32
+ } ,
33
+ actions : {
34
+ flexGrow : 0 ,
35
+ } ,
36
+ content : ( theme : Theme ) => ( {
37
+ overflowY : 'auto' ,
38
+ overflowX : 'hidden' ,
39
+ maxHeight : 'calc(100% - 15vh)' ,
40
+ paddingRight : theme . spacing ( 2 ) ,
41
+ paddingTop : theme . spacing ( 2 ) ,
42
+ paddingBottom : theme . spacing ( 1 ) ,
43
+ flexGrow : 1 ,
44
+ } ) ,
45
+ } ;
46
+
21
47
export function LoadFlowParametersForm ( {
22
48
loadflowMethods,
23
49
renderTitleFields,
@@ -39,42 +65,30 @@ export function LoadFlowParametersForm({
39
65
40
66
return (
41
67
< CustomFormProvider validationSchema = { formSchema } { ...formMethods } removeOptional >
42
- { renderTitleFields ?.( ) }
43
- < Box
44
- sx = { {
45
- height : '100%' ,
46
- display : 'flex' ,
47
- position : 'relative' ,
48
- flexDirection : 'column' ,
49
- } }
50
- >
68
+ < Box sx = { styles . form } >
69
+ { renderTitleFields ?.( ) }
51
70
{ paramsLoaded ? (
52
- < Box
53
- sx = { {
54
- height : '100%' ,
55
- display : 'flex' ,
56
- position : 'relative' ,
57
- flexDirection : 'column' ,
58
- } }
59
- >
71
+ < Box sx = { styles . loadflowParameters } >
60
72
< LoadFlowParametersHeader
61
73
selectedTab = { selectedTab }
62
74
handleTabChange = { handleTabChange }
63
75
tabIndexesWithError = { tabIndexesWithError }
64
76
formattedProviders = { formattedProviders }
65
77
/>
66
- < LoadFlowParametersContent
67
- selectedTab = { selectedTab }
68
- currentProvider = { currentProvider ?? '' }
69
- specificParameters = { specificParameters }
70
- params = { params }
71
- defaultLimitReductions = { defaultLimitReductions }
72
- />
78
+ < Grid container sx = { styles . content } >
79
+ < LoadFlowParametersContent
80
+ selectedTab = { selectedTab }
81
+ currentProvider = { currentProvider ?? '' }
82
+ specificParameters = { specificParameters }
83
+ params = { params }
84
+ defaultLimitReductions = { defaultLimitReductions }
85
+ />
86
+ </ Grid >
73
87
</ Box >
74
88
) : (
75
89
< LinearProgress />
76
90
) }
77
- { renderActions ?.( ) }
91
+ { renderActions && < Box sx = { styles . actions } > { renderActions ?.( ) } </ Box > }
78
92
</ Box >
79
93
</ CustomFormProvider >
80
94
) ;
0 commit comments