Skip to content

Commit 1699a84

Browse files
feat: Add tabContainerBorderWidth and fix tab padding
1 parent 2dd05cb commit 1699a84

File tree

4 files changed

+47
-33
lines changed

4 files changed

+47
-33
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ Please note that the badgeStyle, window shadow and border props are only applica
208208
borderWidth?: number,
209209
borderRadius?: number,
210210
paddingY?: number,
211-
paddingX?: number
211+
paddingX?: number,
212+
tabContainerBorderWidth?: number
212213
};
213214
}
214215
```

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export type CustomStyle = {
229229
borderRadius?: number;
230230
paddingY?: number;
231231
paddingX?: number;
232+
tabContainerBorderWidth?: number;
232233
};
233234
};
234235

src/utils/commonUtils.ts

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export const applyTheme = (
197197
theme.customCard?.background ||
198198
DefaultTheme[mode].customCard.background,
199199
padding:
200-
customStyle.customCard?.padding ||
200+
customStyle.customCard?.padding ||
201201
DefaultStyle.customCard.padding,
202202
borderBottom: `${
203203
customStyle.customCard?.borderWidth ||
@@ -228,7 +228,7 @@ export const applyTheme = (
228228
theme.colors?.textColor ||
229229
DefaultTheme[mode].customCard.titleColor,
230230
fontSize:
231-
customStyle.customCard?.titleSize ||
231+
customStyle.customCard?.titleSize ||
232232
DefaultStyle.customCard.titleSize,
233233
fontWeight:
234234
customStyle.customCard?.titleFontWeight ||
@@ -261,13 +261,13 @@ export const applyTheme = (
261261
customStyle.customCard?.descriptionSize ||
262262
DefaultStyle.customCard.descriptionSize,
263263
fontWeight:
264-
customStyle.customCard?.descriptionFontWeight ||
265-
DefaultStyle.customCard.descriptionFontWeight,
264+
customStyle.customCard?.descriptionFontWeight ||
265+
DefaultStyle.customCard.descriptionFontWeight,
266266
},
267267
dateStyle: {
268268
color: theme.colors?.dateColor || DefaultTheme[mode].colors.dateColor,
269269
fontSize:
270-
customStyle.customCard?.dateSize ||
270+
customStyle.customCard?.dateSize ||
271271
DefaultStyle.customCard.dateSize,
272272
lineHeight: "16px",
273273
},
@@ -320,7 +320,7 @@ export const applyTheme = (
320320
height: customStyle.badgeStyle?.size || defaultBadgeStyle.size,
321321
backgroundColor: theme.badgeStyle?.color || defaultBadgeStyle.color,
322322
top: customStyle?.badgeStyle?.top ? `${customStyle.badgeStyle.top}px` : defaultBadgeStyle.top,
323-
right: customStyle?.badgeStyle?.right ? `${customStyle.badgeStyle.right}px` : defaultBadgeStyle.right,
323+
right: customStyle?.badgeStyle?.right ? `${customStyle.badgeStyle.right}px` : defaultBadgeStyle.right,
324324
},
325325
badgeTextStyle: {
326326
color: theme.badgeStyle?.textColor || defaultBadgeStyle.textColor,
@@ -333,35 +333,40 @@ export const applyTheme = (
333333
DefaultTheme[mode].colors.primaryColor
334334
}`,
335335
},
336-
tabsHeaderContainer:{
336+
tabsHeaderContainer: {
337337
height: customStyle.tabs?.containerHeight || DefaultStyle.tabs.containerHeight,
338338
backgroundColor: theme.tabs?.containerBackgroundColor || DefaultTheme[mode].tabs.containerBackgroundColor,
339339
borderBottom: `${
340-
customStyle.customCard?.borderWidth ||
341-
DefaultStyle.customCard.borderWidth
340+
(customStyle.tabs?.tabContainerBorderWidth === undefined || customStyle.tabs?.tabContainerBorderWidth === null)?
341+
DefaultStyle.tabs.tabContainerBorderWidth :
342+
customStyle.tabs?.tabContainerBorderWidth
342343
}px solid`,
343344
borderColor:
344345
theme.customCard?.borderColor ||
345346
theme.colors?.borderColor ||
346347
DefaultTheme[mode].customCard.borderColor,
347-
padding: `0 ${customStyle.tabs?.tabPadding || DefaultStyle.tabs.tabPadding}px`,
348-
gap: customStyle.tabs?.headingGap || DefaultStyle.tabs.headingGap
349-
348+
padding: `0 ${
349+
customStyle.tabs?.tabPadding === undefined ||
350+
customStyle.tabs?.tabPadding === null
351+
? DefaultStyle.tabs.tabPadding
352+
: customStyle.tabs?.tabPadding
353+
}px`,
354+
gap: customStyle.tabs?.headingGap || DefaultStyle.tabs.headingGap,
350355
},
351356
activeTabStyle:{
352357
backgroundColor: theme.tabs?.activeTabBackgroundColor || DefaultTheme[mode].tabs.activeTabBackgroundColor,
353358
color: theme.tabs?.activeTabTextColor || DefaultTheme[mode].tabs.activeTabTextColor,
354359
fontSize: customStyle.tabs?.activeTabTextSize || DefaultStyle.tabs.activeTabTextSize,
355360
fontWeight: customStyle.tabs?.activeTabTextWeight || DefaultStyle.tabs.activeTabTextWeight,
356361
border: `${
357-
customStyle.tabs?.borderWidth ||
362+
customStyle.tabs?.borderWidth ||
358363
DefaultStyle.tabs.borderWidth
359364
}px solid`,
360365
borderColor:
361-
theme.tabs?.borderColor ||
362-
theme.colors?.borderColor ||
363-
DefaultTheme[mode].tabs?.borderColor,
364-
borderRadius: customStyle.tabs?.borderRadius ||
366+
theme.tabs?.borderColor ||
367+
theme.colors?.borderColor ||
368+
DefaultTheme[mode].tabs?.borderColor,
369+
borderRadius: customStyle.tabs?.borderRadius ||
365370
DefaultStyle.tabs.borderRadius,
366371
padding: `${customStyle.tabs?.paddingY || DefaultStyle.tabs.paddingY}px
367372
${customStyle.tabs?.paddingX || DefaultStyle.tabs.paddingX}px`,
@@ -372,23 +377,26 @@ export const applyTheme = (
372377
fontSize: customStyle.tabs?.inactiveTabTextSize || DefaultStyle.tabs.inactiveTabTextSize,
373378
fontWeight: customStyle.tabs?.inactiveTabTextWeight || DefaultStyle.tabs.inactiveTabTextWeight,
374379
border: `${
375-
customStyle.tabs?.borderWidth ||
380+
customStyle.tabs?.borderWidth ||
376381
DefaultStyle.tabs.borderWidth
377382
}px solid`,
378383
borderColor:
379-
theme.tabs?.borderColor ||
380-
theme.colors?.borderColor ||
381-
DefaultTheme[mode].tabs?.borderColor,
382-
borderRadius: customStyle.tabs?.borderRadius ||
384+
theme.tabs?.borderColor ||
385+
theme.colors?.borderColor ||
386+
DefaultTheme[mode].tabs?.borderColor,
387+
borderRadius: customStyle.tabs?.borderRadius ||
383388
DefaultStyle.tabs.borderRadius,
384389
padding: `${customStyle.tabs?.paddingY || DefaultStyle.tabs.paddingY}px
385390
${customStyle.tabs?.paddingX || DefaultStyle.tabs.paddingX}px`,
386391
},
387392
activeTabIndicator:{
388393
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-
}
394+
height:
395+
customStyle.tabs?.indicatorHeight === undefined ||
396+
customStyle.tabs?.indicatorHeight === null
397+
? DefaultStyle.tabs.indicatorHeight
398+
: customStyle.tabs?.indicatorHeight,
399+
},
392400
};
393401
};
394402

@@ -429,7 +437,7 @@ export const generateFilterParams = (
429437
if (fromStart) params = { ...params, start: data[0].createdAt };
430438
else params = { ...params, end: data[data.length - 1].createdAt };
431439

432-
if (filterType === Tabs.UNREAD) params = { ...params, isRead: false};
440+
if (filterType === Tabs.UNREAD) params = { ...params, isRead: false };
433441

434442
return params;
435443
};
@@ -483,7 +491,6 @@ export const calculateModalWidth = (containerWidth: DimensionValue): number => {
483491
return modalWidth;
484492
};
485493

486-
487494
export const debounce = <F extends (...args: unknown[]) => void>(
488495
func: F,
489496
delay: number
@@ -498,22 +505,26 @@ export const debounce = <F extends (...args: unknown[]) => void>(
498505
};
499506
};
500507

501-
export const getModalContentHeightInFullScreen = (headerHeight: DimensionValue | undefined) => {
508+
export const getModalContentHeightInFullScreen = (
509+
headerHeight: DimensionValue | undefined
510+
) => {
502511
let updatedHeight = 0;
503512

504513
if (typeof headerHeight === "string")
505514
updatedHeight = parseInt(headerHeight.slice(0, -2));
506515
else if (typeof headerHeight === "number") updatedHeight = headerHeight;
507516

508-
return `calc(100% - ${updatedHeight}px)`
517+
return `calc(100% - ${updatedHeight}px)`;
509518
};
510519

511520
export const generateUniqueId = (): string => {
512521
return Math.random().toString(36).substring(2, 15);
513522
};
514523

515-
export const mergeStyles = (...styleObjects: CSSProperties[]): CSSProperties => {
524+
export const mergeStyles = (
525+
...styleObjects: CSSProperties[]
526+
): CSSProperties => {
516527
return styleObjects.reduce((mergedStyles, currentStyle) => {
517528
return { ...mergedStyles, ...currentStyle };
518529
}, {});
519-
};
530+
};

src/utils/defaultStyles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ const defaultStyles = {
6161
borderWidth: 0,
6262
borderRadius: 0,
6363
paddingX: 10,
64-
paddingY: 5
64+
paddingY: 5,
65+
tabContainerBorderWidth: 0.5,
6566
}
6667
}
6768

0 commit comments

Comments
 (0)