@@ -119,6 +119,13 @@ export const logger = {
119119 } ,
120120} ;
121121
122+ export const getCustomStyleValues = ( customValue ?: number , defaultValue ?: number ) => {
123+ return customValue === undefined ||
124+ customValue === null
125+ ? defaultValue
126+ : customValue
127+ }
128+
122129export const applyTheme = (
123130 theme : ThemeProps = { } ,
124131 mode : ThemeMode = ThemeMode . DARK ,
@@ -197,7 +204,7 @@ export const applyTheme = (
197204 theme . customCard ?. background ||
198205 DefaultTheme [ mode ] . customCard . background ,
199206 padding :
200- customStyle . customCard ?. padding ||
207+ customStyle . customCard ?. padding ||
201208 DefaultStyle . customCard . padding ,
202209 borderBottom : `${
203210 customStyle . customCard ?. borderWidth ||
@@ -228,7 +235,7 @@ export const applyTheme = (
228235 theme . colors ?. textColor ||
229236 DefaultTheme [ mode ] . customCard . titleColor ,
230237 fontSize :
231- customStyle . customCard ?. titleSize ||
238+ customStyle . customCard ?. titleSize ||
232239 DefaultStyle . customCard . titleSize ,
233240 fontWeight :
234241 customStyle . customCard ?. titleFontWeight ||
@@ -261,13 +268,13 @@ export const applyTheme = (
261268 customStyle . customCard ?. descriptionSize ||
262269 DefaultStyle . customCard . descriptionSize ,
263270 fontWeight :
264- customStyle . customCard ?. descriptionFontWeight ||
265- DefaultStyle . customCard . descriptionFontWeight ,
271+ customStyle . customCard ?. descriptionFontWeight ||
272+ DefaultStyle . customCard . descriptionFontWeight ,
266273 } ,
267274 dateStyle : {
268275 color : theme . colors ?. dateColor || DefaultTheme [ mode ] . colors . dateColor ,
269276 fontSize :
270- customStyle . customCard ?. dateSize ||
277+ customStyle . customCard ?. dateSize ||
271278 DefaultStyle . customCard . dateSize ,
272279 lineHeight : "16px" ,
273280 } ,
@@ -320,7 +327,7 @@ export const applyTheme = (
320327 height : customStyle . badgeStyle ?. size || defaultBadgeStyle . size ,
321328 backgroundColor : theme . badgeStyle ?. color || defaultBadgeStyle . color ,
322329 top : customStyle ?. badgeStyle ?. top ? `${ customStyle . badgeStyle . top } px` : defaultBadgeStyle . top ,
323- right : customStyle ?. badgeStyle ?. right ? `${ customStyle . badgeStyle . right } px` : defaultBadgeStyle . right ,
330+ right : customStyle ?. badgeStyle ?. right ? `${ customStyle . badgeStyle . right } px` : defaultBadgeStyle . right ,
324331 } ,
325332 badgeTextStyle : {
326333 color : theme . badgeStyle ?. textColor || defaultBadgeStyle . textColor ,
@@ -333,35 +340,35 @@ export const applyTheme = (
333340 DefaultTheme [ mode ] . colors . primaryColor
334341 } `,
335342 } ,
336- tabsHeaderContainer :{
343+ tabsHeaderContainer : {
337344 height : customStyle . tabs ?. containerHeight || DefaultStyle . tabs . containerHeight ,
338345 backgroundColor : theme . tabs ?. containerBackgroundColor || DefaultTheme [ mode ] . tabs . containerBackgroundColor ,
339346 borderBottom : `${
340- customStyle . customCard ?. borderWidth ||
341- DefaultStyle . customCard . borderWidth
347+ getCustomStyleValues ( customStyle . tabs ?. tabContainerBorderWidth , DefaultStyle . tabs . tabContainerBorderWidth )
342348 } px solid`,
343349 borderColor :
344350 theme . customCard ?. borderColor ||
345351 theme . colors ?. borderColor ||
346352 DefaultTheme [ mode ] . customCard . borderColor ,
347- padding : `0 ${ customStyle . tabs ?. tabPadding || DefaultStyle . tabs . tabPadding } px` ,
348- gap : customStyle . tabs ?. headingGap || DefaultStyle . tabs . headingGap
349-
353+ padding : `0 ${
354+ getCustomStyleValues ( customStyle . tabs ?. tabPadding , DefaultStyle . tabs . tabPadding )
355+ } px`,
356+ gap : customStyle . tabs ?. headingGap || DefaultStyle . tabs . headingGap ,
350357 } ,
351358 activeTabStyle :{
352359 backgroundColor : theme . tabs ?. activeTabBackgroundColor || DefaultTheme [ mode ] . tabs . activeTabBackgroundColor ,
353360 color : theme . tabs ?. activeTabTextColor || DefaultTheme [ mode ] . tabs . activeTabTextColor ,
354361 fontSize : customStyle . tabs ?. activeTabTextSize || DefaultStyle . tabs . activeTabTextSize ,
355362 fontWeight : customStyle . tabs ?. activeTabTextWeight || DefaultStyle . tabs . activeTabTextWeight ,
356363 border : `${
357- customStyle . tabs ?. borderWidth ||
364+ customStyle . tabs ?. borderWidth ||
358365 DefaultStyle . tabs . borderWidth
359366 } px solid`,
360367 borderColor :
361- theme . tabs ?. borderColor ||
362- theme . colors ?. borderColor ||
363- DefaultTheme [ mode ] . tabs ?. borderColor ,
364- borderRadius : customStyle . tabs ?. borderRadius ||
368+ theme . tabs ?. borderColor ||
369+ theme . colors ?. borderColor ||
370+ DefaultTheme [ mode ] . tabs ?. borderColor ,
371+ borderRadius : customStyle . tabs ?. borderRadius ||
365372 DefaultStyle . tabs . borderRadius ,
366373 padding : `${ customStyle . tabs ?. paddingY || DefaultStyle . tabs . paddingY } px
367374 ${ customStyle . tabs ?. paddingX || DefaultStyle . tabs . paddingX } px` ,
@@ -372,23 +379,22 @@ export const applyTheme = (
372379 fontSize : customStyle . tabs ?. inactiveTabTextSize || DefaultStyle . tabs . inactiveTabTextSize ,
373380 fontWeight : customStyle . tabs ?. inactiveTabTextWeight || DefaultStyle . tabs . inactiveTabTextWeight ,
374381 border : `${
375- customStyle . tabs ?. borderWidth ||
382+ customStyle . tabs ?. borderWidth ||
376383 DefaultStyle . tabs . borderWidth
377384 } px solid`,
378385 borderColor :
379- theme . tabs ?. borderColor ||
380- theme . colors ?. borderColor ||
381- DefaultTheme [ mode ] . tabs ?. borderColor ,
382- borderRadius : customStyle . tabs ?. borderRadius ||
386+ theme . tabs ?. borderColor ||
387+ theme . colors ?. borderColor ||
388+ DefaultTheme [ mode ] . tabs ?. borderColor ,
389+ borderRadius : customStyle . tabs ?. borderRadius ||
383390 DefaultStyle . tabs . borderRadius ,
384391 padding : `${ customStyle . tabs ?. paddingY || DefaultStyle . tabs . paddingY } px
385392 ${ customStyle . tabs ?. paddingX || DefaultStyle . tabs . paddingX } px` ,
386393 } ,
387394 activeTabIndicator :{
388395 backgroundColor : theme . tabs ?. indicatorColor || DefaultTheme [ mode ] . tabs . indicatorColor ,
389- height : ( customStyle . tabs ?. indicatorHeight === undefined || customStyle . tabs ?. indicatorHeight === null ) ?
390- DefaultStyle . tabs . indicatorHeight : customStyle . tabs ?. indicatorHeight ,
391- }
396+ height : getCustomStyleValues ( customStyle . tabs ?. indicatorHeight , DefaultStyle . tabs . indicatorHeight )
397+ } ,
392398 } ;
393399} ;
394400
@@ -429,7 +435,7 @@ export const generateFilterParams = (
429435 if ( fromStart ) params = { ...params , start : data [ 0 ] . createdAt } ;
430436 else params = { ...params , end : data [ data . length - 1 ] . createdAt } ;
431437
432- if ( filterType === Tabs . UNREAD ) params = { ...params , isRead : false } ;
438+ if ( filterType === Tabs . UNREAD ) params = { ...params , isRead : false } ;
433439
434440 return params ;
435441} ;
@@ -483,7 +489,6 @@ export const calculateModalWidth = (containerWidth: DimensionValue): number => {
483489 return modalWidth ;
484490} ;
485491
486-
487492export const debounce = < F extends ( ...args : unknown [ ] ) => void > (
488493 func : F ,
489494 delay : number
@@ -498,22 +503,26 @@ export const debounce = <F extends (...args: unknown[]) => void>(
498503 } ;
499504} ;
500505
501- export const getModalContentHeightInFullScreen = ( headerHeight : DimensionValue | undefined ) => {
506+ export const getModalContentHeightInFullScreen = (
507+ headerHeight : DimensionValue | undefined
508+ ) => {
502509 let updatedHeight = 0 ;
503510
504511 if ( typeof headerHeight === "string" )
505512 updatedHeight = parseInt ( headerHeight . slice ( 0 , - 2 ) ) ;
506513 else if ( typeof headerHeight === "number" ) updatedHeight = headerHeight ;
507514
508- return `calc(100% - ${ updatedHeight } px)`
515+ return `calc(100% - ${ updatedHeight } px)` ;
509516} ;
510517
511518export const generateUniqueId = ( ) : string => {
512519 return Math . random ( ) . toString ( 36 ) . substring ( 2 , 15 ) ;
513520} ;
514521
515- export const mergeStyles = ( ...styleObjects : CSSProperties [ ] ) : CSSProperties => {
522+ export const mergeStyles = (
523+ ...styleObjects : CSSProperties [ ]
524+ ) : CSSProperties => {
516525 return styleObjects . reduce ( ( mergedStyles , currentStyle ) => {
517526 return { ...mergedStyles , ...currentStyle } ;
518527 } , { } ) ;
519- } ;
528+ } ;
0 commit comments