hds-web 1.2.6 → 1.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hds-web",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -20,7 +20,7 @@ export default function MediaViewer ({ img_url, video_url, video_poster, width }
20
20
  </div>
21
21
  )}
22
22
 
23
- {video_url && (
23
+ {video_url && video_poster && (
24
24
  <div>
25
25
  {!isVideoPlaying ? (
26
26
  <div className='relative flex justify-center'>
@@ -9,11 +9,12 @@ import PropTypes from 'prop-types';
9
9
  const tabCard = (tabContent) => (
10
10
  <>
11
11
  <div className='px-3'>
12
- <Typography textStyle='h4' className={HDSColor(tabContent.title_color)}>{tabContent.title}</Typography>
12
+ {tabContent.title &&<Typography textStyle='h4' className={HDSColor(tabContent.title_color)}>{tabContent.title}</Typography>}
13
13
 
14
- <Typography textStyle='body1c' className={HDSColor(tabContent.sub_title_color)}>{tabContent.sub_title}</Typography>
14
+ {tabContent.sub_title &&<Typography textStyle='body1c' className={HDSColor(tabContent.sub_title_color)}>{tabContent.sub_title}</Typography>}
15
15
  </div>
16
- <div className='flex pl-3 pt-6 pb-8'>
16
+ {tabContent.btnLabel &&
17
+ <div className='flex pl-3 pt-6 pb-8'>
17
18
  <HDSButton
18
19
  label={tabContent.btnLabel}
19
20
  type='secondaryLink'
@@ -27,32 +28,34 @@ const tabCard = (tabContent) => (
27
28
  className='flex'
28
29
  btnTextColorClass='text-blue-600'
29
30
  />
30
- </div>
31
- <div className=''>
31
+ </div>}
32
+ <div className='mt-8'>
32
33
  <MediaBox
33
34
  img_url={tabContent.img_url}
34
35
  video_url={tabContent.video_url}
35
36
  video_poster={tabContent.video_poster}
36
- width={400}
37
37
  />
38
38
  </div>
39
39
  </>
40
40
  )
41
41
 
42
42
  export default function NavCard(props) {
43
- // const [activeTab, setActiveTab] = useState('');
43
+ const [activeTab, setActiveTab] = useState('');
44
44
 
45
- // useEffect(() => {
46
- // if (props.tabContent) {
47
- // const tabNames = Object.keys(props.tabContent);
48
- // setActiveTab(tabNames[0]);
49
- // }
50
- // }, [props.tabContent]);
45
+ useEffect(() => {
46
+ if (props.tabContent) {
47
+ const tabNames = Object.keys(props.tabContent);
48
+ setActiveTab(tabNames[0]);
49
+ }
50
+ }, [props.tabContent]);
51
51
 
52
- // function handleTabClick(tab) {
53
- // setActiveTab(tab.name);
54
- // // Perform any other actions based on the clicked tab
55
- // }
52
+ const handleTabClick = (tab) => {
53
+ if(tab.name){
54
+ setActiveTab(tab.name);
55
+ }
56
+ else return ;
57
+ // Perform any other actions based on the clicked tab
58
+ }
56
59
 
57
60
  return (
58
61
  <>
@@ -66,48 +69,13 @@ export default function NavCard(props) {
66
69
  tabs={props.navTabs}
67
70
  />
68
71
  </div>
69
- <div className='transition-all ease-in-out duration-1000'>
70
- {/* {props.tabContent &&
72
+ <div className=''>
73
+ {props.tabContent &&
71
74
  props.tabContent[activeTab] &&
72
- tabCard(props.tabContent[activeTab])} */}
75
+ tabCard(props.tabContent[activeTab])}
73
76
  </div>
74
77
 
75
78
  </div>}
76
79
  </>
77
80
  )
78
81
  }
79
-
80
- NavCard.defaultProps = {
81
- tabContent: {
82
- 'Performance': {
83
- title: '1Get blazing-fast APIs without the extra work',
84
- sub_title: 'Hasura simplifies data access and reduces latency for optimizing performance via a Haskell core, JIT query compiler, predicate pushdown, and application-level caching out of the box.',
85
- },
86
- 'Company': {
87
- title: '2Get blazing-fast APIs without the extra work',
88
- sub_title: 'Hasura simplifies data access and reduces latency for optimizing performance via a Haskell core, JIT query compiler, predicate pushdown, and application-level caching out of the box.',
89
- },
90
- 'Authorization': {
91
- title: '3Get blazing-fast APIs without the extra work',
92
- sub_title: 'Hasura simplifies data access and reduces latency for optimizing performance via a Haskell core, JIT query compiler, predicate pushdown, and application-level caching out of the box.',
93
- },
94
- },
95
-
96
- navTabs: [
97
- {
98
- current: true,
99
- href: '',
100
- name: 'Performance'
101
- },
102
- {
103
- current: 'Insant Api',
104
- href: '',
105
- name: 'Company'
106
- },
107
- {
108
- current: '[Circular]',
109
- href: '',
110
- name: 'Authorization'
111
- },
112
- ]
113
- }