Skip to content

Commit bea90fd

Browse files
committed
refactor: TabGroup - badge, icon size based on size variant
1 parent 0b448ea commit bea90fd

File tree

3 files changed

+23
-28
lines changed

3 files changed

+23
-28
lines changed

src/Assets/Icon/ic-warning-y6.svg

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Shared/Components/TabGroup/TabGroup.component.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Link, NavLink } from 'react-router-dom'
22

33
import { ReactComponent as ICErrorExclamation } from '@Icons/ic-error-exclamation.svg'
4-
import { ReactComponent as ICWarning } from '@Icons/ic-warning-y6.svg'
4+
import { ReactComponent as ICWarning } from '@Icons/ic-warning.svg'
55
import { ComponentSizeType } from '@Shared/constants'
66

77
import { TabGroupProps, TabProps } from './TabGroup.types'
@@ -27,27 +27,33 @@ const Tab = ({
2727
case ComponentSizeType.medium:
2828
return {
2929
tabClassName: `fs-12 ${!hideTopPadding ? 'pt-6' : ''} ${alignActiveBorderWithContainer ? 'pb-5' : 'pb-6'}`,
30+
iconClassName: 'icon-dim-14',
31+
badgeClassName: 'fs-11 lh-18 tab-group__tab__badge--medium',
3032
}
3133
default:
3234
return {
3335
tabClassName: `fs-13 ${!hideTopPadding ? 'pt-8' : ''} ${alignActiveBorderWithContainer ? 'pb-7' : 'pb-8'}`,
36+
iconClassName: 'icon-dim-16',
37+
badgeClassName: 'fs-12 lh-20',
3438
}
3539
}
3640
}
37-
const { tabClassName } = getClassNameBySize()
41+
const { tabClassName, iconClassName, badgeClassName } = getClassNameBySize()
3842

3943
const getTabComponent = () => {
4044
const content = (
4145
<>
42-
{showError && <ICErrorExclamation className="icon-dim-14" />}
43-
{!showError && showWarning && <ICWarning className="icon-dim-14" />}
46+
{showError && <ICErrorExclamation className={`${iconClassName}`} />}
47+
{!showError && showWarning && <ICWarning className={`${iconClassName} tab-group__tab__warning-icon`} />}
4448
{!showError && !showWarning && Icon && (
4549
<Icon
46-
className={`icon-dim-14 ${iconType === 'fill' ? 'tab-group__tab__icon--fill' : 'tab-group__tab__icon--stroke'} ${(active && (iconType === 'fill' ? 'fcb-5' : 'scb-5')) || (iconType === 'fill' ? 'fcn-7' : 'scn-7')}`}
50+
className={`${iconClassName} ${iconType === 'fill' ? 'tab-group__tab__icon--fill' : 'tab-group__tab__icon--stroke'} ${(active && (iconType === 'fill' ? 'fcb-5' : 'scb-5')) || (iconType === 'fill' ? 'fcn-7' : 'scn-7')}`}
4751
/>
4852
)}
4953
{label}
50-
{badge !== null && <div className="tab-group__tab__badge bcn-1 flex fs-12 lh-18 cn-7">{badge}</div>}
54+
{badge !== null && (
55+
<div className={`tab-group__tab__badge ${badgeClassName} bcn-1 flex cn-7`}>{badge}</div>
56+
)}
5157
{showIndicator && <span className="tab-group__tab__indicator bcr-5 mt-4 dc__align-self-start" />}
5258
</>
5359
)

src/Shared/Components/TabGroup/TabGroup.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@
4848

4949
&__badge {
5050
border-radius: 100%;
51-
height: 18px;
52-
width: 18px;
51+
width: 20px;
52+
53+
&--medium {
54+
width: 18px;
55+
}
5356
}
5457

5558
&__indicator {
@@ -58,6 +61,12 @@
5861
border-radius: 100%;
5962
}
6063

64+
&__warning-icon {
65+
> g path:nth-of-type(2) {
66+
fill: var(--Y700);
67+
}
68+
}
69+
6170
&__nav-link {
6271
&.active {
6372
color: var(--B500);

0 commit comments

Comments
 (0)