hds-web 1.2.9 → 1.3.1
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.css +2 -2
- package/dist/index.es.css +2 -2
- package/dist/index.es.js +6 -6
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/src/HDS/components/Avatars/hasConAv.js +4 -4
- package/src/HDS/components/BadgesCaption/badges.js +6 -3
- package/src/HDS/components/Buttons/button.js +1 -0
- package/src/HDS/components/Cards/Link/link.js +3 -4
- package/src/HDS/components/Cards/Misc/iconCard.js +6 -4
- package/src/HDS/components/Cards/Misc/index.js +1 -0
- package/src/HDS/components/Cards/Misc/talkCard.js +2 -4
- package/src/HDS/components/Cards/Misc/talkcard2.js +112 -0
- package/src/HDS/components/Headers/v3Header.js +93 -78
- package/src/HDS/components/Hero/h3.js +152 -0
- package/src/HDS/components/Hero/index.js +2 -1
- package/src/HDS/components/Tabs/tab.js +3 -3
- package/src/HDS/foundation/Typography/Typography.js +1 -0
- package/src/HDS/helpers/Grid/grid.js +61 -0
- package/src/HDS/helpers/Grid/index.js +1 -0
- package/src/HDS/helpers/Media/mediabox.js +1 -1
- package/src/index.css +9 -0
- package/src/styles/tailwind.css +229 -85
@@ -0,0 +1,152 @@
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
2
|
+
import { MediaBox } from '../../helpers/Media';
|
3
|
+
import { Typography } from '../../foundation/Typography';
|
4
|
+
import { HDSButton } from '../../components/Buttons';
|
5
|
+
import { HDSColor } from '../../foundation/ColorPalette';
|
6
|
+
import { Tab } from '../../components/Tabs';
|
7
|
+
import PropTypes from 'prop-types';
|
8
|
+
import { LinkCard } from '../Cards/Link';
|
9
|
+
|
10
|
+
const tabCard = (tabContent) => (
|
11
|
+
<>
|
12
|
+
<div className='tb:px-3'>
|
13
|
+
{tabContent.title &&
|
14
|
+
<Typography
|
15
|
+
textStyle='h2'
|
16
|
+
className={HDSColor(tabContent.title_color)}>
|
17
|
+
{tabContent.title}
|
18
|
+
</Typography>}
|
19
|
+
|
20
|
+
{tabContent.sub_title &&
|
21
|
+
<Typography
|
22
|
+
textStyle='sub2'
|
23
|
+
className={`mt-2 ${HDSColor(tabContent.sub_title_color)}`}>
|
24
|
+
{tabContent.sub_title}
|
25
|
+
</Typography>}
|
26
|
+
</div>
|
27
|
+
{tabContent.btnLabel &&
|
28
|
+
<div className='flex pl-3 pt-6'>
|
29
|
+
<HDSButton
|
30
|
+
label={tabContent.btnLabel}
|
31
|
+
type='secondary'
|
32
|
+
leftIconVariant='none'
|
33
|
+
rightIconVariant='none'
|
34
|
+
state='default'
|
35
|
+
size='sm'
|
36
|
+
rightAnimatedArrow={true}
|
37
|
+
rightAnimatedArrowColor='#1E56E3'
|
38
|
+
animatedHoverStroke='group-hover:stroke-blue-600'
|
39
|
+
className='flex'
|
40
|
+
btnTextColorClass='text-blue-600'
|
41
|
+
/>
|
42
|
+
</div>
|
43
|
+
}
|
44
|
+
|
45
|
+
</>
|
46
|
+
)
|
47
|
+
|
48
|
+
export default function HeroCapability(props) {
|
49
|
+
|
50
|
+
const LinkCardsFn = (heroData) => {
|
51
|
+
return (
|
52
|
+
heroData.linkCards && (
|
53
|
+
<div className="flex mt-16 gap-6 justify-center">
|
54
|
+
{heroData.linkCards.map((card, index) => (
|
55
|
+
<div key={index} className="w-full">
|
56
|
+
<LinkCard
|
57
|
+
titleTextColor= {card.titleTextColor}
|
58
|
+
descTextColor={card.descTextColor}
|
59
|
+
linkUrl={card.linkUrl}
|
60
|
+
cardBgColor={card.cardBgColor}
|
61
|
+
cardHoverBg={card.cardHoverBg}
|
62
|
+
iconVariant={card.iconVariant}
|
63
|
+
iconStrokeColor={card.iconStrokeColor}
|
64
|
+
iconArrowVariant={card.iconArrowVariant}
|
65
|
+
iconArrowStrokeColor={card.iconArrowStrokeColor}
|
66
|
+
title={card.title}
|
67
|
+
description={card.description}
|
68
|
+
/>
|
69
|
+
</div>
|
70
|
+
))}
|
71
|
+
</div>
|
72
|
+
)
|
73
|
+
);
|
74
|
+
};
|
75
|
+
|
76
|
+
|
77
|
+
const [activeTab, setActiveTab] = useState('');
|
78
|
+
|
79
|
+
useEffect(() => {
|
80
|
+
if (props.heroData.tabContent) {
|
81
|
+
const tabNames = Object.keys(props.heroData.tabContent);
|
82
|
+
setActiveTab(tabNames[0]);
|
83
|
+
}
|
84
|
+
}, [props.heroData.tabContent]);
|
85
|
+
|
86
|
+
const handleTabClick = (tab) => {
|
87
|
+
if (tab.name) {
|
88
|
+
setActiveTab(tab.name);
|
89
|
+
}
|
90
|
+
else return;
|
91
|
+
// Perform any other actions based on the clicked tab
|
92
|
+
}
|
93
|
+
let bgClass = '';
|
94
|
+
let bgTabClass = '';
|
95
|
+
let video_url = '';
|
96
|
+
let video_poster = '';
|
97
|
+
let img_url = '';
|
98
|
+
if(props.heroData && props.heroData.tabContent && props.heroData.tabContent[activeTab] && props.heroData.tabContent[activeTab]['bg_color']){
|
99
|
+
bgClass = HDSColor(props.heroData.tabContent[activeTab]['bg_color'])
|
100
|
+
}
|
101
|
+
if(props.heroData && props.heroData.tabContent && props.heroData.tabContent[activeTab] && props.heroData.tabContent[activeTab]['bg_color_tab']){
|
102
|
+
bgTabClass = HDSColor(props.heroData.tabContent[activeTab]['bg_color_tab'])
|
103
|
+
}
|
104
|
+
if(props.heroData && props.heroData.tabContent && props.heroData.tabContent[activeTab] && props.heroData.tabContent[activeTab]['video_url']){
|
105
|
+
video_url = props.heroData.tabContent[activeTab]['video_url']
|
106
|
+
}
|
107
|
+
if(props.heroData && props.heroData.tabContent && props.heroData.tabContent[activeTab] && props.heroData.tabContent[activeTab]['video_poster']){
|
108
|
+
video_poster = props.heroData.tabContent[activeTab]['video_poster']
|
109
|
+
}
|
110
|
+
if(props.heroData && props.heroData.tabContent && props.heroData.tabContent[activeTab] && props.heroData.tabContent[activeTab]['img_url']){
|
111
|
+
img_url = props.heroData.tabContent[activeTab]['img_url']
|
112
|
+
}
|
113
|
+
|
114
|
+
return (
|
115
|
+
<div className={`${bgClass} max-w-7xl rounded-3xl`} >
|
116
|
+
{props.heroData.navTabs &&
|
117
|
+
|
118
|
+
<div className='pt-5 px-8 db:p-20 tb:p-10 flex flex-col shadow rounded-2xl'>
|
119
|
+
|
120
|
+
<div className='flex overflow-visible scrollbar-hide tb-l:justify-center justify-start'>
|
121
|
+
<div className={`${bgTabClass} rounded-[32px]`}>
|
122
|
+
<Tab
|
123
|
+
onTabClick={handleTabClick}
|
124
|
+
tabs={props.heroData.navTabs}
|
125
|
+
/>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
<div className='flex flex-col-reverse pt-6 tb:flex tb:flex-row tb:items-center tb:pt-10 tb:justify-between'>
|
129
|
+
<div className=' mt-3 db:max-w-[488px] tb:w-1/2'>
|
130
|
+
{props.heroData.tabContent &&
|
131
|
+
props.heroData.tabContent[activeTab] &&
|
132
|
+
tabCard(props.heroData.tabContent[activeTab])}
|
133
|
+
</div>
|
134
|
+
<div className=' db:max-w-[540px] tb:w-1/2 '>
|
135
|
+
<MediaBox
|
136
|
+
video_url = {video_url}
|
137
|
+
video_poster = {video_poster}
|
138
|
+
img_url = {img_url}
|
139
|
+
/>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div>
|
144
|
+
{LinkCardsFn(props.heroData)}
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
}
|
149
|
+
|
150
|
+
</div>
|
151
|
+
)
|
152
|
+
}
|
@@ -27,7 +27,7 @@ export default function Tab(props) {
|
|
27
27
|
};
|
28
28
|
|
29
29
|
return (
|
30
|
-
<div>
|
30
|
+
<div className=''>
|
31
31
|
<div className="block">
|
32
32
|
<nav className="relative inline-flex gap-2 rounded-full" aria-label="Tabs">
|
33
33
|
{tabs.map(tab => (
|
@@ -36,8 +36,8 @@ export default function Tab(props) {
|
|
36
36
|
href="#"
|
37
37
|
className={`px-3 py-1 font-medium text-sm rounded-full ${
|
38
38
|
activeTab === tab
|
39
|
-
? ' first:bg-blue-500 text-neutral-0 transition-all delay-
|
40
|
-
: 'text-neutral-500 transition-all
|
39
|
+
? ' first:bg-blue-500 text-neutral-0 transition-all delay-500 duration-100 '
|
40
|
+
: 'text-neutral-500 transition-all flex-nowrap '
|
41
41
|
}`}
|
42
42
|
aria-current={activeTab === tab ? 'page' : undefined}
|
43
43
|
onClick={(event) => handleTabClick(event, tab)}
|
@@ -16,6 +16,7 @@ export default function Typography(props) {
|
|
16
16
|
'h4': 'text-hds-m-h4 tb:text-hds-t-h4 db:text-hds-d-h4',
|
17
17
|
'h5': 'text-hds-m-h5 tb:text-hds-t-h5 db:text-hds-d-h5',
|
18
18
|
'h6': 'text-hds-m-h6 tb:text-hds-t-h6 db:text-hds-d-h6',
|
19
|
+
'h7': 'text-hds-m-h7 tb:text-hds-t-h7 db:text-hds-d-h7',
|
19
20
|
'sub1': 'text-hds-m-sub1 tb:text-hds-t-sub1 db:text-hds-d-sub1',
|
20
21
|
'sub2': 'text-hds-m-sub2 tb:text-hds-t-sub2 db:text-hds-d-sub2',
|
21
22
|
'body1': 'text-hds-m-body1 tb:text-hds-t-body1 db:text-hds-d-body1',
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
const GridComponent = ({ cards, gridSize }) => {
|
4
|
+
const numCards = cards.length;
|
5
|
+
const cardsLeftInLastRow = numCards % gridSize;
|
6
|
+
const lastRowColSpan = `col-span-${gridSize / cardsLeftInLastRow}`;
|
7
|
+
|
8
|
+
const renderCards = () => {
|
9
|
+
return cards.map((card, index) => (
|
10
|
+
<div
|
11
|
+
className='gridClass'
|
12
|
+
key={index}
|
13
|
+
>
|
14
|
+
{/* Render card content */}
|
15
|
+
{card}
|
16
|
+
</div>
|
17
|
+
));
|
18
|
+
};
|
19
|
+
|
20
|
+
return (
|
21
|
+
<div className='flex flex-wrap'>
|
22
|
+
{renderCards()}
|
23
|
+
</div>
|
24
|
+
);
|
25
|
+
};
|
26
|
+
|
27
|
+
export default GridComponent;
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
// 2x2, 3x3, 4x4
|
33
|
+
// odd even
|
34
|
+
|
35
|
+
//2x2 -odd grid grid-cols-2
|
36
|
+
//case 1: NOC = 3
|
37
|
+
// .... ....
|
38
|
+
// ......... colr-span-2
|
39
|
+
|
40
|
+
|
41
|
+
//3x3 -odd
|
42
|
+
//case 1: noc:5
|
43
|
+
/// ... ... ...
|
44
|
+
// ..... ..... col-span-1.5 col-span-1.5
|
45
|
+
//case 2: noc:4
|
46
|
+
/// ... ... ...
|
47
|
+
// ........... col-span-3
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
//4x4
|
52
|
+
|
53
|
+
// case1: noc 5:
|
54
|
+
// .. .. .. ..
|
55
|
+
// ........... col-span-4
|
56
|
+
// case2: noc 6:
|
57
|
+
// .. .. .. ..
|
58
|
+
// ..... ..... col-span-2 col span-2
|
59
|
+
// case1: noc 7:
|
60
|
+
// .. .. .. ..
|
61
|
+
// ... ... ... col-span-4/3 col-span-4/3 col-span-4/3
|
@@ -0,0 +1 @@
|
|
1
|
+
export {default as GridComponent} from './grid';
|
@@ -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 && video_poster && (
|
23
|
+
{video_url && !img_url && video_poster && (
|
24
24
|
<div>
|
25
25
|
{!isVideoPlaying ? (
|
26
26
|
<div className='relative flex justify-center'>
|
package/src/index.css
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
@tailwind utilities;
|
4
4
|
/* Typography classes */
|
5
5
|
|
6
|
+
.gridAutoClass {
|
7
|
+
flex: 1 0 30%;
|
8
|
+
margin-top: 40px;
|
9
|
+
margin-right: 32px;
|
10
|
+
background: blue;
|
11
|
+
justify-content: center;
|
12
|
+
display: flex;
|
13
|
+
}
|
14
|
+
|
6
15
|
@keyframes pill-move-left {
|
7
16
|
0% {
|
8
17
|
left: 0;
|