@@ -13,28 +13,26 @@ import {
13
13
ScrollView ,
14
14
Stack ,
15
15
} from '../..' ;
16
- import { BreakpointToken } from '../../../types' ;
16
+ import { BreakpointToken , SpaceToken } from '../../../types' ;
17
17
18
18
const breakpointControls = {
19
- mobile : { marginBottom : { mobile : 'space-800' } , className : '' } ,
20
- tablet : { marginBottom : { tablet : 'space-800' } , className : 'd-none d-tablet-grid' } ,
21
- desktop : { marginBottom : { } , className : 'd-none d-desktop-grid' } ,
19
+ mobile : { marginBottom : { mobile : 'space-800' } , className : 'border-0 ' } ,
20
+ tablet : { marginBottom : { tablet : 'space-800' } , className : 'd-none d-tablet-grid border-0 ' } ,
21
+ desktop : { marginBottom : { } , className : 'd-none d-desktop-grid border-0 ' } ,
22
22
} ;
23
23
24
24
const setVerticalDimensionValueForProp = (
25
25
prevState : { height : Record < BreakpointToken , number > ; maxHeight : Record < BreakpointToken , number > } ,
26
26
breakpoint : BreakpointToken ,
27
27
event : ChangeEvent < HTMLInputElement > ,
28
28
propName : 'height' | 'maxHeight' ,
29
- ) => {
30
- return {
31
- ...prevState ,
32
- [ propName ] : {
33
- ...prevState [ propName ] ,
34
- [ breakpoint ] : Number ( event . target . value ) ,
35
- } ,
36
- } ;
37
- } ;
29
+ ) => ( {
30
+ ...prevState ,
31
+ [ propName ] : {
32
+ ...prevState [ propName ] ,
33
+ [ breakpoint ] : Number ( event . target . value ) ,
34
+ } ,
35
+ } ) ;
38
36
39
37
const ModalScrollingLongContent = ( ) => {
40
38
const [ isModalLongContentOpen , setModalLongContentOpen ] = useState ( false ) ;
@@ -80,8 +78,8 @@ const ModalScrollingLongContent = () => {
80
78
setHeightValue ( ( prevState ) => setVerticalDimensionValueForProp ( prevState , breakpoint , event , 'height' ) ) ;
81
79
} ;
82
80
83
- const generateHeightObject = ( isMax = false ) => {
84
- return ( [ 'mobile' , 'tablet' , 'desktop' ] as BreakpointToken [ ] ) . reduce (
81
+ const generateHeightObject = ( isMax = false ) =>
82
+ ( [ 'mobile' , 'tablet' , 'desktop' ] as BreakpointToken [ ] ) . reduce (
85
83
( acc , breakpoint ) => {
86
84
acc [ breakpoint ] = isCustomHeightEnabled [ breakpoint ]
87
85
? `${ heightValue [ isMax ? 'maxHeight' : 'height' ] [ breakpoint ] } px`
@@ -91,7 +89,6 @@ const ModalScrollingLongContent = () => {
91
89
} ,
92
90
{ } as Record < BreakpointToken , string | null > ,
93
91
) ;
94
- } ;
95
92
96
93
return (
97
94
< >
@@ -216,14 +213,21 @@ const ModalScrollingLongContent = () => {
216
213
< ModalHeader > Modal with Custom Height</ ModalHeader >
217
214
< ModalBody >
218
215
< form >
219
- { Object . entries ( breakpointControls ) . map ( ( [ breakpoint , { marginBottom, className } ] ) => (
216
+ { (
217
+ Object . entries ( breakpointControls ) as [
218
+ BreakpointToken ,
219
+ {
220
+ marginBottom : Partial < Record < string , SpaceToken > > ;
221
+ className : string ;
222
+ } ,
223
+ ] [ ]
224
+ ) . map ( ( [ breakpoint , { marginBottom, className } ] ) => (
220
225
< Stack
221
226
elementType = "fieldset"
222
227
hasSpacing
223
228
key = { breakpoint }
224
- marginBottom = { marginBottom as Partial < Record < string , `space-${ number } ` > > }
229
+ marginBottom = { marginBottom as Partial < Record < string , SpaceToken > > }
225
230
UNSAFE_className = { className }
226
- UNSAFE_style = { { border : 0 } }
227
231
>
228
232
< legend hidden > { breakpoint . charAt ( 0 ) . toUpperCase ( ) + breakpoint . slice ( 1 ) } </ legend >
229
233
< Checkbox
@@ -237,7 +241,7 @@ const ModalScrollingLongContent = () => {
237
241
} ) )
238
242
}
239
243
/>
240
- < Grid UNSAFE_style = { { columnGap : 'var(--spirit- space-600)' } } >
244
+ < Grid spacingX = " space-600" >
241
245
< Label
242
246
UNSAFE_className = "GridItem"
243
247
htmlFor = { `custom-height-${ breakpoint } ` }
@@ -274,7 +278,7 @@ const ModalScrollingLongContent = () => {
274
278
type = "range"
275
279
/>
276
280
</ Grid >
277
- < Grid UNSAFE_style = { { columnGap : 'var(--spirit- space-600)' } } >
281
+ < Grid spacingX = " space-600" >
278
282
< Label
279
283
UNSAFE_className = "GridItem"
280
284
htmlFor = { `custom-max-height-${ breakpoint } ` }
0 commit comments