hds-web 1.2.6 → 1.2.8

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.8",
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,105 +9,73 @@ 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'>
17
- <HDSButton
18
- label={tabContent.btnLabel}
19
- type='secondaryLink'
20
- leftIconVariant='none'
21
- rightIconVariant='none'
22
- state='default'
23
- size='sm'
24
- rightAnimatedArrow={true}
25
- rightAnimatedArrowColor='#1E56E3'
26
- animatedHoverStroke='group-hover:stroke-blue-600'
27
- className='flex'
28
- btnTextColorClass='text-blue-600'
29
- />
30
- </div>
31
- <div className=''>
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
+ <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('');
44
-
45
- // useEffect(() => {
46
- // if (props.tabContent) {
47
- // const tabNames = Object.keys(props.tabContent);
48
- // setActiveTab(tabNames[0]);
49
- // }
50
- // }, [props.tabContent]);
51
-
52
- // function handleTabClick(tab) {
53
- // setActiveTab(tab.name);
54
- // // Perform any other actions based on the clicked tab
55
- // }
56
-
43
+ const [activeTab, setActiveTab] = useState('');
44
+
45
+ useEffect(() => {
46
+ if (props.tabContent) {
47
+ const tabNames = Object.keys(props.tabContent);
48
+ setActiveTab(tabNames[0]);
49
+ }
50
+ }, [props.tabContent]);
51
+
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
+ }
59
+
57
60
  return (
58
- <>
59
- {props.navTabs &&
61
+ <div>
62
+ {props.navTabs &&
60
63
 
61
- <div className='max-w-[44.44rem] p-16 bg-neutral-0 shadow rounded-2xl'>
64
+ <div className='max-w-[44.44rem] p-16 bg-neutral-0 shadow rounded-2xl'>
62
65
 
63
- <div className='flex justify-center pb-8'>
64
- <Tab
65
- onTabClick={handleTabClick}
66
- tabs={props.navTabs}
67
- />
68
- </div>
69
- <div className='transition-all ease-in-out duration-1000'>
70
- {/* {props.tabContent &&
71
- props.tabContent[activeTab] &&
72
- tabCard(props.tabContent[activeTab])} */}
73
- </div>
66
+ <div className='flex justify-center pb-8'>
67
+ <Tab
68
+ onTabClick={handleTabClick}
69
+ tabs={props.navTabs}
70
+ />
71
+ </div>
72
+ <div className=''>
73
+ {props.tabContent &&
74
+ props.tabContent[activeTab] &&
75
+ tabCard(props.tabContent[activeTab])}
76
+ </div>
74
77
 
75
- </div>}
76
- </>
78
+ </div>}
79
+ </div>
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
- }