hds-web 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +6 -6
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/src/HDS/modules/navCard/navCard.js +46 -45
package/package.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import React, { useState, useEffect } from 'react';
|
2
2
|
import { MediaBox } from '../../helpers/Media';
|
3
3
|
import { Typography } from '../../foundation/Typography';
|
4
4
|
import { HDSButton } from '../../components/Buttons';
|
@@ -9,26 +9,27 @@ import PropTypes from 'prop-types';
|
|
9
9
|
const tabCard = (tabContent) => (
|
10
10
|
<>
|
11
11
|
<div className='px-3'>
|
12
|
-
{tabContent.title
|
12
|
+
{tabContent.title && <Typography textStyle='h4' className={HDSColor(tabContent.title_color)}>{tabContent.title}</Typography>}
|
13
13
|
|
14
|
-
{tabContent.sub_title
|
14
|
+
{tabContent.sub_title && <Typography textStyle='body1c' className={HDSColor(tabContent.sub_title_color)}>{tabContent.sub_title}</Typography>}
|
15
15
|
</div>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
{tabContent.btnLabel &&
|
17
|
+
<div className='flex pl-3 pt-6 pb-8'>
|
18
|
+
<HDSButton
|
19
|
+
label={tabContent.btnLabel}
|
20
|
+
type='secondaryLink'
|
21
|
+
leftIconVariant='none'
|
22
|
+
rightIconVariant='none'
|
23
|
+
state='default'
|
24
|
+
size='sm'
|
25
|
+
rightAnimatedArrow={true}
|
26
|
+
rightAnimatedArrowColor='#1E56E3'
|
27
|
+
animatedHoverStroke='group-hover:stroke-blue-600'
|
28
|
+
className='flex'
|
29
|
+
btnTextColorClass='text-blue-600'
|
30
|
+
/>
|
31
|
+
</div>
|
32
|
+
}
|
32
33
|
<div className='mt-8'>
|
33
34
|
<MediaBox
|
34
35
|
img_url={tabContent.img_url}
|
@@ -41,41 +42,41 @@ const tabCard = (tabContent) => (
|
|
41
42
|
|
42
43
|
export default function NavCard(props) {
|
43
44
|
const [activeTab, setActiveTab] = useState('');
|
44
|
-
|
45
|
+
|
45
46
|
useEffect(() => {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
if (props.tabContent) {
|
48
|
+
const tabNames = Object.keys(props.tabContent);
|
49
|
+
setActiveTab(tabNames[0]);
|
50
|
+
}
|
50
51
|
}, [props.tabContent]);
|
51
|
-
|
52
|
+
|
52
53
|
const handleTabClick = (tab) => {
|
53
|
-
if(tab.name){
|
54
|
+
if (tab.name) {
|
54
55
|
setActiveTab(tab.name);
|
55
56
|
}
|
56
|
-
else return
|
57
|
-
|
57
|
+
else return;
|
58
|
+
// Perform any other actions based on the clicked tab
|
58
59
|
}
|
59
|
-
|
60
|
+
|
60
61
|
return (
|
61
|
-
|
62
|
-
|
62
|
+
<div>
|
63
|
+
{props.navTabs &&
|
63
64
|
|
64
|
-
|
65
|
+
<div className='max-w-[44.44rem] p-16 bg-neutral-0 shadow rounded-2xl'>
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
67
|
+
<div className='flex justify-center pb-8'>
|
68
|
+
<Tab
|
69
|
+
onTabClick={handleTabClick}
|
70
|
+
tabs={props.navTabs}
|
71
|
+
/>
|
72
|
+
</div>
|
73
|
+
<div className=''>
|
74
|
+
{props.tabContent &&
|
75
|
+
props.tabContent[activeTab] &&
|
76
|
+
tabCard(props.tabContent[activeTab])}
|
77
|
+
</div>
|
77
78
|
|
78
|
-
|
79
|
-
|
79
|
+
</div>}
|
80
|
+
</div>
|
80
81
|
)
|
81
82
|
}
|