1
1
import { Link , NavLink } from 'react-router-dom'
2
2
3
- import { ReactComponent as ICErrorExclamation } from '@Icons/ic-error-exclamation.svg'
4
- import { ReactComponent as ICWarning } from '@Icons/ic-warning.svg'
5
3
import { ComponentSizeType } from '@Shared/constants'
6
4
7
5
import { TabGroupProps , TabProps } from './TabGroup.types'
8
6
import { getClassNameBySizeMap , tabGroupClassMap } from './TabGroup.utils'
7
+ import { getTabBadge , getTabDescription , getTabIcon , getTabIndicator } from './TabGroup.helpers'
9
8
10
9
import './TabGroup.scss'
11
10
@@ -14,7 +13,7 @@ const Tab = ({
14
13
props,
15
14
tabType,
16
15
active,
17
- icon : Icon ,
16
+ icon,
18
17
size,
19
18
badge = null ,
20
19
alignActiveBorderWithContainer,
@@ -34,29 +33,12 @@ const Tab = ({
34
33
const content = (
35
34
< >
36
35
< p className = "m-0 flexbox dc__align-items-center dc__gap-6" >
37
- { showError && < ICErrorExclamation className = { `${ iconClassName } ` } /> }
38
- { ! showError && showWarning && < ICWarning className = { `${ iconClassName } warning-icon-y7` } /> }
39
- { ! showError && ! showWarning && Icon && < Icon className = { `${ iconClassName } tab-group__tab__icon` } /> }
36
+ { getTabIcon ( { className : iconClassName , icon, showError, showWarning } ) }
40
37
{ label }
41
- { badge !== null && (
42
- < div className = { `tab-group__tab__badge bcn-1 cn-7 fw-6 flex px-4 ${ badgeClassName } ` } >
43
- { badge }
44
- </ div >
45
- ) }
46
- { showIndicator && < span className = "tab-group__tab__indicator bcr-5 mt-4 dc__align-self-start" /> }
38
+ { getTabBadge ( badge , badgeClassName ) }
39
+ { getTabIndicator ( showIndicator ) }
47
40
</ p >
48
- { description && (
49
- < ul className = "tab-group__tab__description m-0 p-0 fs-12 lh-16 fw-4 cn-7 flexbox dc__align-items-center dc__gap-4" >
50
- { Array . isArray ( description )
51
- ? description . map ( ( desc , idx ) => (
52
- < li key = { desc } className = "flex dc__gap-4" >
53
- { ! ! idx && < span className = "dc__bullet" /> }
54
- { desc }
55
- </ li >
56
- ) )
57
- : description }
58
- </ ul >
59
- ) }
41
+ { getTabDescription ( description ) }
60
42
</ >
61
43
)
62
44
0 commit comments