hds-web 1.0.1 → 1.0.3
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 +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/src/HDS/components/Avatars/profileAvatar.js +28 -16
- package/src/HDS/components/BadgesCaption/badges.js +10 -10
- package/src/HDS/components/Buttons/button.js +18 -7
- package/src/HDS/components/Cards/Feedback/feedback.js +25 -0
- package/src/HDS/components/Cards/Feedback/index.js +1 -0
- package/src/HDS/components/Cards/Link/index.js +2 -0
- package/src/HDS/components/Cards/Link/link.js +86 -0
- package/src/HDS/components/Cards/Link/resources.js +53 -0
- package/src/HDS/components/Cards/Menu/flyoutB.js +1 -0
- package/src/HDS/components/Cards/Misc/talkCard.js +22 -18
- package/src/HDS/components/Cards/TalkDetailCard/index.js +1 -0
- package/src/HDS/components/Cards/TalkDetailCard/talkDetailCard.js +68 -0
- package/src/HDS/components/Hero/h1.js +0 -1
- package/src/HDS/components/Hero/h2.js +198 -0
- package/src/HDS/components/Hero/index.js +2 -1
- package/src/HDS/components/Tables/index.js +2 -1
- package/src/HDS/components/Tables/tableB.js +146 -0
- package/src/HDS/components/Tabs/tab.js +2 -2
- package/src/HDS/components/common-components/Icon/IconMap.js +6 -4
- package/src/HDS/foundation/ColorPalette/color.js +97 -2
- package/src/HDS/helpers/Time/time.js +70 -48
- package/src/HDS/index.js +2 -1
- package/src/HDS/modules/TextCard/index.js +1 -0
- package/src/HDS/modules/TextCard/textCard.js +132 -0
- package/src/HDS/modules/index.js +1 -0
- package/src/styles/tailwind.css +647 -34
- package/tailwind.config.js +22 -0
@@ -0,0 +1,198 @@
|
|
1
|
+
import { useState, useEffect } from "react";
|
2
|
+
import { Typography } from "../../foundation/Typography";
|
3
|
+
import { HDSButton } from "../Buttons";
|
4
|
+
import { HDSColor } from "../../foundation/ColorPalette";
|
5
|
+
import { Icon } from "../common-components";
|
6
|
+
import { LinkCard } from '../Cards/Link';
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
8
|
+
|
9
|
+
export default function HeroSecondary({ heroData, logo, scrollArrow, fontSize }) {
|
10
|
+
const [valumeMuteIcon, setValumeMuteIcon] = useState("volumex");
|
11
|
+
const videoMute = () => {
|
12
|
+
if (heroData.video_url) {
|
13
|
+
const videoEle = document.getElementById("hero_vid");
|
14
|
+
if (videoEle?.muted) {
|
15
|
+
videoEle.muted = false;
|
16
|
+
setValumeMuteIcon("volumemax")
|
17
|
+
} else {
|
18
|
+
videoEle.muted = true;
|
19
|
+
setValumeMuteIcon("volumex")
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
const videoComponent = (heroData) => (
|
25
|
+
heroData.video_url ? (
|
26
|
+
<div className={"relative" + ((heroData.video_gradient_bg) ? "" : " p-4")}>
|
27
|
+
<div className="w-12 h-12 bg-neutral-0 rounded-full absolute right-8 bottom-8 shadow-md cursor-pointer z-[2] flex items-center justify-center" onClick={() => videoMute()}>
|
28
|
+
<Icon height={'w-6 h-6 stroke-neutral-800 stroke-[1.5px]'} variant={valumeMuteIcon} strokeColor="#1F2A37" />
|
29
|
+
</div>
|
30
|
+
<video
|
31
|
+
id="hero_vid"
|
32
|
+
controls={false}
|
33
|
+
// autoPlay
|
34
|
+
loop
|
35
|
+
muted
|
36
|
+
poster="https://res.cloudinary.com/dh8fp23nd/image/upload/v1683015500/hasura-con-2023/engage_clgotb.png"
|
37
|
+
className={"tb:w-full w-full " + ((heroData.video_gradient_bg) ? "" : " rounded-xl shadow-md")}
|
38
|
+
>
|
39
|
+
<source
|
40
|
+
src={heroData.video_url}
|
41
|
+
type="video/mp4"
|
42
|
+
/>
|
43
|
+
</video>
|
44
|
+
{
|
45
|
+
heroData.video_gradient_bg && (<div className={`tb-l:w-1/2 w-full h-1/2 tb:h-full absolute left-0 top-0 tb-l:ml-[-4px] tb-l:bg-gradient-to-r ${videoGradientBg} to-transparent bg-gradient-to-b tb:mt-[-4px] tb-l:mt-0`}></div>)
|
46
|
+
}
|
47
|
+
</div>
|
48
|
+
) : (
|
49
|
+
<div className="w-full"
|
50
|
+
variants={{
|
51
|
+
hidden: {
|
52
|
+
opacity: 0,
|
53
|
+
},
|
54
|
+
visible: {
|
55
|
+
opacity: 1,
|
56
|
+
transition: {
|
57
|
+
delay: .2,
|
58
|
+
duration: 1,
|
59
|
+
}
|
60
|
+
},
|
61
|
+
}}
|
62
|
+
>
|
63
|
+
{heroData.img_url && (
|
64
|
+
<div className="text-right pt-0 flex items-end justify-end h-full">
|
65
|
+
<img
|
66
|
+
src={heroData.img_url}
|
67
|
+
alt="Hero"
|
68
|
+
className="db:inline tb:w-[90%] tb-l:w-[70%] db:w-[75%] w-full rounded-b-3xl"
|
69
|
+
/>
|
70
|
+
</div>
|
71
|
+
)}
|
72
|
+
</div>
|
73
|
+
)
|
74
|
+
)
|
75
|
+
|
76
|
+
const title = () => (
|
77
|
+
heroData.title && (
|
78
|
+
<div
|
79
|
+
|
80
|
+
>
|
81
|
+
{
|
82
|
+
logo ? (
|
83
|
+
<div className={"pb-4 db:text-left text-center tb-l:text-left" + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}>
|
84
|
+
<img className="w-[290px] inline-block" src={logo} alt="Brand" />
|
85
|
+
</div>
|
86
|
+
) : (
|
87
|
+
<Typography textStyle={fontSize ? fontSize : "h1"} as="h1" className={"pb-2 text-center break-words db:text-left tb-l:text-left " + ((heroData.title_color) ? heroData.title_color : "") + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}>{heroData.title}</Typography>
|
88
|
+
)
|
89
|
+
}
|
90
|
+
</div>
|
91
|
+
)
|
92
|
+
)
|
93
|
+
|
94
|
+
const heroButton = () => (
|
95
|
+
heroData.buttons && (
|
96
|
+
<div className={" gap-2 flex items-center justify-center tb-l:justify-start db:justify-start pt-6" + ((heroData.video_url) ? " tb:justify-center" : " tb:justify-start")}>
|
97
|
+
{
|
98
|
+
heroData.buttons.map((btn, index) => (
|
99
|
+
<HDSButton
|
100
|
+
leftIconVariant='none'
|
101
|
+
rightIconVariant='none'
|
102
|
+
label={btn.cta_text}
|
103
|
+
state='default'
|
104
|
+
size='lg'
|
105
|
+
rightAnimatedArrow='true'
|
106
|
+
rightAnimatedArrowColor='#ffffff'
|
107
|
+
/>
|
108
|
+
))
|
109
|
+
}
|
110
|
+
</div>
|
111
|
+
)
|
112
|
+
)
|
113
|
+
|
114
|
+
const LinkCardsFn = (heroData) => {
|
115
|
+
return (
|
116
|
+
heroData.linkCards && (
|
117
|
+
<div className="flex mt-16 px-20 pb-20 gap-6 justify-center">
|
118
|
+
{heroData.linkCards.map((card) => (
|
119
|
+
<div key={uuidv4()} className="w-full">
|
120
|
+
<LinkCard
|
121
|
+
linkUrl={card.linkUrl}
|
122
|
+
cardBgColor={card.cardBgColor}
|
123
|
+
cardHoverBg={card.cardHoverBg}
|
124
|
+
iconVariant={card.iconVariant}
|
125
|
+
iconStrokeColor={card.iconStrokeColor}
|
126
|
+
iconArrowVariant={card.iconArrowVariant}
|
127
|
+
iconArrowStrokeColor={card.iconArrowStrokeColor}
|
128
|
+
title={card.title}
|
129
|
+
description={card.description}
|
130
|
+
/>
|
131
|
+
</div>
|
132
|
+
))}
|
133
|
+
</div>
|
134
|
+
)
|
135
|
+
);
|
136
|
+
};
|
137
|
+
|
138
|
+
const imageCard = (heroData) => (
|
139
|
+
heroData.imageUrl && (
|
140
|
+
<div className="">
|
141
|
+
<img src={heroData.imageUrl} alt={heroData.imageAlt} className='w-[560px] h-[580px] rounded-b-3xl' />
|
142
|
+
</div>
|
143
|
+
)
|
144
|
+
)
|
145
|
+
|
146
|
+
const videoGradientBg = HDSColor(heroData.video_gradient_bg);
|
147
|
+
return (
|
148
|
+
<div className="db:pt-32 mb-10 db:mb-5 tb:mb-16 tb-l:mb-0">
|
149
|
+
<div className="tb:px-4">
|
150
|
+
<div className={"max-w-7xl mx-auto rounded-3xl overflow-hidden " + ((heroData.bg_color) ? heroData.bg_color : "")} >
|
151
|
+
<div className="w-full">
|
152
|
+
<div className={"db:flex db:w-full tb-l:flex block" + ((heroData.video_url) ? " tb:block" : " tb:flex")}>
|
153
|
+
<div className={("w-full")}
|
154
|
+
>
|
155
|
+
{
|
156
|
+
heroData.tag_line && (
|
157
|
+
<div
|
158
|
+
>
|
159
|
+
<Typography textStyle="h6" as="h6" className={"pb-2 uppercase text-center db:text-left font-normal tb-l:text-left " + ((heroData.tag_line_color) ? heroData.tag_line_color : "") + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}
|
160
|
+
>
|
161
|
+
{heroData.tag_line}
|
162
|
+
</Typography>
|
163
|
+
</div>
|
164
|
+
)
|
165
|
+
}
|
166
|
+
{title(heroData)}
|
167
|
+
{
|
168
|
+
heroData.sub_title && (
|
169
|
+
<Typography textStyle="sub1" className={"text-center db:text-left tb-l:text-left " + ((heroData.sub_title_color) ? heroData.sub_title_color : "") + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}>{heroData.sub_title}</Typography>
|
170
|
+
)
|
171
|
+
}
|
172
|
+
|
173
|
+
{
|
174
|
+
heroData.description && (
|
175
|
+
<Typography textStyle="sub2" className="text-center tb:text-left db:text-left tb-l:text-left text-blue-700 [&>*]:mb-8 last:[&>*]:mb-0">{heroData.description}</Typography>
|
176
|
+
)
|
177
|
+
}
|
178
|
+
{heroButton(heroData)}
|
179
|
+
|
180
|
+
|
181
|
+
</div>
|
182
|
+
{imageCard(heroData)}
|
183
|
+
</div>
|
184
|
+
|
185
|
+
{LinkCardsFn(heroData)}
|
186
|
+
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
{
|
190
|
+
scrollArrow && (
|
191
|
+
<>
|
192
|
+
</>
|
193
|
+
)
|
194
|
+
}
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
);
|
198
|
+
}
|
@@ -1 +1,2 @@
|
|
1
|
-
export {default as Hero1} from './h1'
|
1
|
+
export {default as Hero1} from './h1'
|
2
|
+
export {default as HeroSecondary} from './h2'
|
@@ -1 +1,2 @@
|
|
1
|
-
export {default as TableA} from './tableA';
|
1
|
+
export {default as TableA} from './tableA';
|
2
|
+
export {default as TableB} from './tableB';
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
3
|
+
import { Typography } from '../../foundation/Typography'
|
4
|
+
import { Icon } from '../common-components/Icon'
|
5
|
+
|
6
|
+
const test = (TABLE_HEADER) => (
|
7
|
+
console.log(TABLE_HEADER[0]['title']),
|
8
|
+
Object.keys(TABLE_HEADER[0]).map((key, value) => (
|
9
|
+
|
10
|
+
<th
|
11
|
+
key={key}
|
12
|
+
scope="col"
|
13
|
+
className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"
|
14
|
+
>
|
15
|
+
{key}
|
16
|
+
</th>
|
17
|
+
))
|
18
|
+
)
|
19
|
+
|
20
|
+
export default function TableB(props) {
|
21
|
+
const {
|
22
|
+
title,
|
23
|
+
description,
|
24
|
+
TABLE_VALUE,
|
25
|
+
TABLE_HEADER,
|
26
|
+
children
|
27
|
+
|
28
|
+
} = props;
|
29
|
+
test(TABLE_HEADER);
|
30
|
+
return (
|
31
|
+
<div className="px-4 sm:px-6 lg:px-8 ">
|
32
|
+
<div className="sm:flex sm:items-center ">
|
33
|
+
<div className="sm:flex-auto flex flex-col items-center">
|
34
|
+
{title && (
|
35
|
+
<Typography
|
36
|
+
textStyle='h2'>
|
37
|
+
{title}
|
38
|
+
</Typography>
|
39
|
+
)
|
40
|
+
}
|
41
|
+
{description && (
|
42
|
+
<Typography
|
43
|
+
textStyle='body1c'>
|
44
|
+
{description}
|
45
|
+
</Typography>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div>
|
52
|
+
<div className="-mx-4 mt-8 sm:-mx-0 bg-neutral-0 rounded-3xl ">
|
53
|
+
<table className="min-w-full shadow rounded-3xl ">
|
54
|
+
<thead>
|
55
|
+
<tr className='divide-x divide-neutral-200 text-center rounded-t-3xl'>
|
56
|
+
{Object.keys(TABLE_HEADER).map((key, value) => (
|
57
|
+
<th
|
58
|
+
key={key}
|
59
|
+
scope="col"
|
60
|
+
className="px-8 py-6 sm:table-cell"
|
61
|
+
>
|
62
|
+
<div className=''>
|
63
|
+
<div className='flex flex-col justify-center items-center text-center'>
|
64
|
+
<div className={'flex items-center gap-2'}>
|
65
|
+
{TABLE_HEADER[key]['icon'] &&
|
66
|
+
(
|
67
|
+
<Icon
|
68
|
+
height='h-6 w-6'
|
69
|
+
variant={TABLE_HEADER[key]['icon']}
|
70
|
+
strokeClass={TABLE_HEADER[key]['iconStrokeClass']} />
|
71
|
+
)
|
72
|
+
}
|
73
|
+
{
|
74
|
+
TABLE_HEADER[key]['title'] && key==0 && (
|
75
|
+
<Typography
|
76
|
+
textStyle='h5'
|
77
|
+
className={TABLE_HEADER[key]['title_text_color']}>
|
78
|
+
{TABLE_HEADER[key]['title']}
|
79
|
+
</Typography>)
|
80
|
+
}
|
81
|
+
{
|
82
|
+
TABLE_HEADER[key]['title'] && key!=0 && (
|
83
|
+
<Typography
|
84
|
+
textStyle='h5'
|
85
|
+
className={TABLE_HEADER[key]['title_text_color']}>
|
86
|
+
{TABLE_HEADER[key]['title']}
|
87
|
+
</Typography>)
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
<div className=' max-w-[10rem]'>
|
93
|
+
{TABLE_HEADER[key]['descr'] && (
|
94
|
+
<Typography
|
95
|
+
textStyle='body1'
|
96
|
+
className={TABLE_HEADER[key]['descr_text_color']}>
|
97
|
+
{TABLE_HEADER[key]['descr']}
|
98
|
+
</Typography>)}
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
</th>
|
103
|
+
))}
|
104
|
+
</tr>
|
105
|
+
</thead>
|
106
|
+
<tbody className="divide-y divide-neutral-200 rounded-b-3xl">
|
107
|
+
{TABLE_VALUE.map((value) => (
|
108
|
+
<tr className='divide-x divide-neutral-200' key={uuidv4()}>
|
109
|
+
{Object.keys(value).map((key) => (
|
110
|
+
<React.Fragment key={uuidv4()}>
|
111
|
+
{key === 'rowTitle' && (<td
|
112
|
+
key={uuidv4()}
|
113
|
+
className="px-8 py-7 w-[22.5rem] whitespace-pre-line "
|
114
|
+
>
|
115
|
+
<Typography className='max-w-[22rem] text-neutral-700' textStyle='body1c'>{value[key]}</Typography>
|
116
|
+
|
117
|
+
</td>)}
|
118
|
+
|
119
|
+
{key !== 'rowTitle' && (
|
120
|
+
<td
|
121
|
+
key={uuidv4()}
|
122
|
+
className="px-8 py-7 text-center"
|
123
|
+
>
|
124
|
+
{value[key]['text'] && (
|
125
|
+
<Typography className='text-neutral-700' textStyle='body1c'>{value[key]['text']}</Typography>
|
126
|
+
|
127
|
+
)}
|
128
|
+
{!value[key]['text'] && (
|
129
|
+
<div className='flex justify-center'>
|
130
|
+
<Icon height='h-5 w-5' variant={value[key]['iconVariant']} strokeClass={value[key]['iconStrokeClass']} />
|
131
|
+
</div>
|
132
|
+
)}
|
133
|
+
|
134
|
+
|
135
|
+
</td>)}
|
136
|
+
</React.Fragment>
|
137
|
+
))}
|
138
|
+
</tr>
|
139
|
+
))}
|
140
|
+
</tbody>
|
141
|
+
</table>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
)
|
146
|
+
}
|
@@ -8,7 +8,7 @@ export default function Tab(props){
|
|
8
8
|
const tabs = Array.isArray(props.tabs) ? props.tabs : [];
|
9
9
|
return (
|
10
10
|
<div>
|
11
|
-
<div className="
|
11
|
+
<div className="md:hidden">
|
12
12
|
<label htmlFor="tabs" className="sr-only">
|
13
13
|
Select a tab
|
14
14
|
</label >
|
@@ -24,7 +24,7 @@ export default function Tab(props){
|
|
24
24
|
))}
|
25
25
|
</select>
|
26
26
|
</div>
|
27
|
-
<div className="hidden
|
27
|
+
<div className="hidden md:block">
|
28
28
|
<nav className="inline-flex gap-2 bg-neutral-0 p-2 rounded-full" aria-label="Tabs">
|
29
29
|
{tabs.length && tabs.map((tab) => (
|
30
30
|
<a
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import {HDSColor} from '../../../foundation/ColorPalette';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import {ReactComponent as HasuraPrimaryIcon } from "../../../assets/icons/HasuraPrimary.svg"
|
4
5
|
import {ReactComponent as ClockrewindIcon } from "../../../assets/icons/clock-rewind.svg"
|
@@ -2351,12 +2352,13 @@ const iconReferenceMap = {
|
|
2351
2352
|
home03: Home03Icon,
|
2352
2353
|
HasuraBlueLogo: HasuraBlueLogoIcon,
|
2353
2354
|
};
|
2354
|
-
export default function Icon ({ variant, height, strokeColor, className }){
|
2355
|
-
const CurrentActiveIcon = iconReferenceMap[variant];
|
2355
|
+
export default function Icon ({ variant, height, strokeColor, strokeClass, className }){
|
2356
|
+
const CurrentActiveIcon = iconReferenceMap[variant] ;
|
2357
|
+
const IconStrokeCLass = HDSColor(strokeClass);
|
2356
2358
|
return (
|
2357
2359
|
<div style={{ stroke: `${strokeColor}` }}>
|
2358
2360
|
<CurrentActiveIcon
|
2359
|
-
className={[`${height}`,
|
2361
|
+
className={[`${height}`, `${IconStrokeCLass}`, `${className}` ].join(' ')}
|
2360
2362
|
/>
|
2361
2363
|
</div>
|
2362
2364
|
);
|
@@ -2364,4 +2366,4 @@ export default function Icon ({ variant, height, strokeColor, className }){
|
|
2364
2366
|
Icon.propTypes = {
|
2365
2367
|
fillColor: PropTypes.string,
|
2366
2368
|
strokeColor: PropTypes.string,
|
2367
|
-
};
|
2369
|
+
};
|
@@ -479,10 +479,105 @@ const HDSColors = {
|
|
479
479
|
"to-red-500": "to-red-500",
|
480
480
|
"to-red-600": "to-red-600",
|
481
481
|
"to-red-700": "to-red-700",
|
482
|
-
"to-red-800": "to-red-800"
|
482
|
+
"to-red-800": "to-red-800",
|
483
|
+
"stroke-base-0": "stroke-base-0",
|
484
|
+
"stroke-base-1000": "stroke-base-1000",
|
485
|
+
"stroke-neutral-0": "stroke-neutral-0",
|
486
|
+
"stroke-neutral-50": "stroke-neutral-50",
|
487
|
+
"stroke-neutral-100": "stroke-neutral-100",
|
488
|
+
"stroke-neutral-150": "stroke-neutral-150",
|
489
|
+
"stroke-neutral-200": "stroke-neutral-200",
|
490
|
+
"stroke-neutral-300": "stroke-neutral-300",
|
491
|
+
"stroke-neutral-400": "stroke-neutral-400",
|
492
|
+
"stroke-neutral-500": "stroke-neutral-500",
|
493
|
+
"stroke-neutral-600": "stroke-neutral-600",
|
494
|
+
"stroke-neutral-700": "stroke-neutral-700",
|
495
|
+
"stroke-neutral-800": "stroke-neutral-800",
|
496
|
+
"stroke-neutral-850": "stroke-neutral-850",
|
497
|
+
"stroke-neutral-900": "stroke-neutral-900",
|
498
|
+
"stroke-neutral-950": "stroke-neutral-950",
|
499
|
+
"stroke-neutral-1000": "stroke-neutral-1000",
|
500
|
+
"stroke-blue-100": "stroke-blue-100",
|
501
|
+
"stroke-blue-200": "stroke-blue-200",
|
502
|
+
"stroke-blue-300": "stroke-blue-300",
|
503
|
+
"stroke-blue-400": "stroke-blue-400",
|
504
|
+
"stroke-blue-500": "stroke-blue-500",
|
505
|
+
"stroke-blue-600": "stroke-blue-600",
|
506
|
+
"stroke-blue-700": "stroke-blue-700",
|
507
|
+
"stroke-blue-800": "stroke-blue-800",
|
508
|
+
"stroke-blue-900": "stroke-blue-900",
|
509
|
+
"stroke-purple-100": "stroke-purple-100",
|
510
|
+
"stroke-purple-200": "stroke-purple-200",
|
511
|
+
"stroke-purple-300": "stroke-purple-300",
|
512
|
+
"stroke-purple-400": "stroke-purple-400",
|
513
|
+
"stroke-purple-500": "stroke-purple-500",
|
514
|
+
"stroke-purple-600": "stroke-purple-600",
|
515
|
+
"stroke-purple-700": "stroke-purple-700",
|
516
|
+
"stroke-purple-800": "stroke-purple-800",
|
517
|
+
"stroke-purple-900": "stroke-purple-900",
|
518
|
+
"stroke-cyan-100": "stroke-cyan-100",
|
519
|
+
"stroke-cyan-200": "stroke-cyan-200",
|
520
|
+
"stroke-cyan-300": "stroke-cyan-300",
|
521
|
+
"stroke-cyan-400": "stroke-cyan-400",
|
522
|
+
"stroke-cyan-500": "stroke-cyan-500",
|
523
|
+
"stroke-cyan-600": "stroke-cyan-600",
|
524
|
+
"stroke-cyan-700": "stroke-cyan-700",
|
525
|
+
"stroke-cyan-800": "stroke-cyan-800",
|
526
|
+
"stroke-cyan-900": "stroke-cyan-900",
|
527
|
+
"stroke-green-100": "stroke-green-100",
|
528
|
+
"stroke-green-200": "stroke-green-200",
|
529
|
+
"stroke-green-300": "stroke-green-300",
|
530
|
+
"stroke-green-400": "stroke-green-400",
|
531
|
+
"stroke-green-500": "stroke-green-500",
|
532
|
+
"stroke-green-600": "stroke-green-600",
|
533
|
+
"stroke-green-700": "stroke-green-700",
|
534
|
+
"stroke-green-800": "stroke-green-800",
|
535
|
+
"stroke-green-900": "stroke-green-900",
|
536
|
+
"stroke-pink-100": "stroke-pink-100",
|
537
|
+
"stroke-pink-200": "stroke-pink-200",
|
538
|
+
"stroke-pink-300": "stroke-pink-300",
|
539
|
+
"stroke-pink-400": "stroke-pink-400",
|
540
|
+
"stroke-pink-500": "stroke-pink-500",
|
541
|
+
"stroke-pink-600": "stroke-pink-600",
|
542
|
+
"stroke-pink-700": "stroke-pink-700",
|
543
|
+
"stroke-pink-800": "stroke-pink-800",
|
544
|
+
"stroke-pink-900": "stroke-pink-900",
|
545
|
+
"stroke-amber-100": "stroke-amber-100",
|
546
|
+
"stroke-amber-200": "stroke-amber-200",
|
547
|
+
"stroke-amber-300": "stroke-amber-300",
|
548
|
+
"stroke-amber-400": "stroke-amber-400",
|
549
|
+
"stroke-amber-500": "stroke-amber-500",
|
550
|
+
"stroke-amber-600": "stroke-amber-600",
|
551
|
+
"stroke-amber-700": "stroke-amber-700",
|
552
|
+
"stroke-amber-800": "stroke-amber-800",
|
553
|
+
"stroke-amber-900": "stroke-amber-900",
|
554
|
+
"stroke-yellow-100": "stroke-yellow-100",
|
555
|
+
"stroke-yellow-200": "stroke-yellow-200",
|
556
|
+
"stroke-yellow-300": "stroke-yellow-300",
|
557
|
+
"stroke-yellow-400": "stroke-yellow-400",
|
558
|
+
"stroke-yellow-500": "stroke-yellow-500",
|
559
|
+
"stroke-yellow-600": "stroke-yellow-600",
|
560
|
+
"stroke-yellow-700": "stroke-yellow-700",
|
561
|
+
"stroke-yellow-800": "stroke-yellow-800",
|
562
|
+
"stroke-orange-100": "stroke-orange-100",
|
563
|
+
"stroke-orange-200": "stroke-orange-200",
|
564
|
+
"stroke-orange-300": "stroke-orange-300",
|
565
|
+
"stroke-orange-400": "stroke-orange-400",
|
566
|
+
"stroke-orange-500": "stroke-orange-500",
|
567
|
+
"stroke-orange-600": "stroke-orange-600",
|
568
|
+
"stroke-orange-700": "stroke-orange-700",
|
569
|
+
"stroke-orange-800": "stroke-orange-800",
|
570
|
+
"stroke-red-100": "stroke-red-100",
|
571
|
+
"stroke-red-200": "stroke-red-200",
|
572
|
+
"stroke-red-300": "stroke-red-300",
|
573
|
+
"stroke-red-400": "stroke-red-400",
|
574
|
+
"stroke-red-500": "stroke-red-500",
|
575
|
+
"stroke-red-600": "stroke-red-600",
|
576
|
+
"stroke-red-700": "stroke-red-700",
|
577
|
+
"stroke-red-800": "stroke-red-800"
|
483
578
|
};
|
484
579
|
|
485
|
-
export default function HDSColor(color = '
|
580
|
+
export default function HDSColor(color = '') {
|
486
581
|
if (!HDSColors[color]) {
|
487
582
|
HDSColors[color] = color;
|
488
583
|
console.log(color);
|
@@ -1,73 +1,95 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
|
-
import { Typography } from '../../foundation/Typography';
|
3
2
|
|
4
|
-
const TimeComponent = ({
|
3
|
+
const TimeComponent = ({ format, countdownTime }) => {
|
5
4
|
const [currentTime, setCurrentTime] = useState(new Date());
|
6
|
-
const [userTimeZone, setUserTimeZone] = useState('');
|
7
5
|
|
8
6
|
useEffect(() => {
|
9
7
|
const interval = setInterval(() => {
|
10
8
|
setCurrentTime(new Date());
|
11
9
|
}, 1000);
|
12
|
-
|
13
|
-
getUserTimeZone();
|
14
|
-
|
15
10
|
return () => clearInterval(interval);
|
16
11
|
}, []);
|
17
12
|
|
18
|
-
const formatTime = (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
13
|
+
const formatTime = () => {
|
14
|
+
switch (format) {
|
15
|
+
case 'MM/dd/yyyy hh:mm:ss tt':
|
16
|
+
return currentTime.toLocaleString('en-US', {
|
17
|
+
month: '2-digit',
|
18
|
+
day: '2-digit',
|
19
|
+
year: 'numeric',
|
20
|
+
hour: 'numeric',
|
21
|
+
minute: 'numeric',
|
22
|
+
second: 'numeric',
|
23
|
+
hour12: true,
|
24
|
+
});
|
25
|
+
case 'yyyy-mm-dd hh:mm:ss':
|
26
|
+
return currentTime.toLocaleString('en-US', {
|
27
|
+
year: 'numeric',
|
28
|
+
month: '2-digit',
|
29
|
+
day: '2-digit',
|
30
|
+
hour: 'numeric',
|
31
|
+
minute: 'numeric',
|
32
|
+
second: 'numeric',
|
33
|
+
}).replace(/,/g, '');
|
34
|
+
case 'yyyy-mm-dd HH:MM:SS tt':
|
35
|
+
return currentTime.toLocaleString('en-US', {
|
36
|
+
year: 'numeric',
|
37
|
+
month: '2-digit',
|
38
|
+
day: '2-digit',
|
39
|
+
hour: 'numeric',
|
40
|
+
minute: 'numeric',
|
41
|
+
second: 'numeric',
|
42
|
+
hour12: false,
|
43
|
+
});
|
44
|
+
case 'm/d/yyyy':
|
45
|
+
return currentTime.toLocaleString('en-US', {
|
46
|
+
month: 'numeric',
|
47
|
+
day: 'numeric',
|
48
|
+
year: 'numeric',
|
49
|
+
});
|
50
|
+
case 'yyyy-mm-dd':
|
51
|
+
return currentTime.toLocaleString('en-US', {
|
52
|
+
year: 'numeric',
|
53
|
+
month: '2-digit',
|
54
|
+
day: '2-digit',
|
55
|
+
});
|
56
|
+
default:
|
57
|
+
return currentTime.toLocaleString();
|
58
|
+
}
|
28
59
|
};
|
29
60
|
|
30
|
-
const
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
const offsetMinutes = Math.abs(offset % 60);
|
35
|
-
const sign = offset < 0 ? '+' : '-';
|
36
|
-
return `GMT${sign}${offsetHours.toString().padStart(2, '0')}:${offsetMinutes
|
37
|
-
.toString()
|
38
|
-
.padStart(2, '0')}`;
|
39
|
-
};
|
61
|
+
const countdown = () => {
|
62
|
+
if (!countdownTime) {
|
63
|
+
return null;
|
64
|
+
}
|
40
65
|
|
41
|
-
|
42
|
-
};
|
66
|
+
const remainingTime = countdownTime - currentTime;
|
43
67
|
|
44
|
-
|
45
|
-
|
46
|
-
return null;
|
68
|
+
if (remainingTime <= 0) {
|
69
|
+
return <div>Time's up!</div>;
|
47
70
|
}
|
48
71
|
|
49
|
-
const
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
const [month, day, year] = dateString.split(' ');
|
54
|
-
const [time, timezone] = timeString.split(' ');
|
55
|
-
const [hours, minutes] = time.split(':');
|
56
|
-
const dateTime = new Date(`${month} ${day}, ${year} ${hours}:${minutes}`);
|
57
|
-
return dateTime.toLocaleString('en-US', { timeZone: timezone });
|
58
|
-
};
|
72
|
+
const seconds = Math.floor(remainingTime / 1000) % 60;
|
73
|
+
const minutes = Math.floor(remainingTime / 1000 / 60) % 60;
|
74
|
+
const hours = Math.floor(remainingTime / 1000 / 60 / 60) % 24;
|
75
|
+
const days = Math.floor(remainingTime / 1000 / 60 / 60 / 24);
|
59
76
|
|
60
|
-
|
61
|
-
|
77
|
+
return (
|
78
|
+
<div>
|
79
|
+
<div>{days} days</div>
|
80
|
+
<div>
|
81
|
+
{hours.toString().padStart(2, '0')}:
|
82
|
+
{minutes.toString().padStart(2, '0')}:
|
83
|
+
{seconds.toString().padStart(2, '0')}
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
);
|
62
87
|
};
|
63
88
|
|
64
89
|
return (
|
65
90
|
<div>
|
66
|
-
<div
|
67
|
-
|
68
|
-
{getUserDateTime() || formatTime(currentTime, userTimeZone)}
|
69
|
-
</Typography>
|
70
|
-
</div>
|
91
|
+
<div>{formatTime()}</div>
|
92
|
+
{countdown()}
|
71
93
|
</div>
|
72
94
|
);
|
73
95
|
};
|
package/src/HDS/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export {default as TextCard} from './textCard';
|