hds-web 1.0.0 → 1.0.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/.github/workflows/chromatic.yml +26 -0
- package/dist/index.css +4 -2
- package/dist/index.es.css +4 -2
- package/dist/index.es.js +11 -3
- package/dist/index.js +11 -3
- package/package.json +7 -3
- package/src/HDS/assets/icons/HasuraPrimary.svg +10 -0
- package/src/HDS/components/BadgesCaption/badges.js +1 -1
- package/src/HDS/components/Buttons/button.js +7 -7
- package/src/HDS/components/Cards/Menu/flyoutB.js +63 -0
- package/src/HDS/components/Cards/Menu/index.js +2 -1
- package/src/HDS/components/Cards/Misc/iconCard.js +22 -0
- package/src/HDS/components/Cards/Misc/index.js +2 -1
- package/src/HDS/components/Cards/Misc/talkCard.js +48 -27
- package/src/HDS/components/Carousels/carouselCard.js +24 -13
- package/src/HDS/components/Headers/customHeader.js +50 -41
- package/src/HDS/components/Headers/v3Header.js +127 -100
- package/src/HDS/components/Hero/h1.js +189 -0
- package/src/HDS/components/Hero/index.js +1 -0
- package/src/HDS/components/Snippet/CodeSnippet.js +58 -58
- package/src/HDS/components/Snippet/index.js +1 -1
- package/src/HDS/components/common-components/Icon/IconMap.js +2 -0
- package/src/HDS/components/index.js +2 -1
- package/src/HDS/foundation/Animations/featureCard.js +77 -0
- package/src/HDS/foundation/Animations/index.js +1 -0
- package/src/HDS/helpers/Time/time.js +48 -70
- package/src/index.css +154 -0
- package/src/styles/tailwind.css +1022 -199
- package/src/HDS/components/Avatars/selectors.js +0 -0
- package/src/HDS/components/Buttons/socialMediaButton.js +0 -78
- package/src/HDS/components/Cards/Misc/featureCard.js +0 -0
- package/src/HDS/foundation/Typography/translated.js +0 -20
@@ -1,70 +1,70 @@
|
|
1
|
-
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import Prism from 'prismjs';
|
4
|
+
import 'prismjs/themes/prism.css';
|
5
|
+
import 'prismjs/components/prism-javascript';
|
2
6
|
|
3
|
-
|
4
|
-
// import 'prismjs/themes/prism.css';
|
5
|
-
// import 'prismjs/components/prism-javascript';
|
7
|
+
function CodeSnippetWithCopy({ snippet, filename, backgroundColor }) {
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
// snippet='as'
|
11
|
-
// }
|
9
|
+
if(!snippet){
|
10
|
+
snippet='as'
|
11
|
+
}
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
const [isCopied, setIsCopied] = useState(false);
|
14
|
+
const preRef = useRef(null);
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
async function copyToClipboard() {
|
17
|
+
try {
|
18
|
+
await navigator.clipboard.writeText(snippet);
|
19
|
+
setIsCopied(true);
|
20
|
+
setTimeout(() => setIsCopied(false), 1500);
|
21
|
+
} catch (error) {
|
22
|
+
console.error('Failed to copy to clipboard', error);
|
23
|
+
}
|
24
|
+
}
|
25
25
|
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
useEffect(() => {
|
28
|
+
console.log(snippet)
|
29
|
+
if (preRef.current ) {
|
30
|
+
Prism.highlightAll();
|
31
|
+
}
|
32
|
+
}, [snippet, preRef.current]);
|
33
33
|
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
const lines = snippet.split('\n');
|
36
|
+
const lineCount = lines.length;
|
37
|
+
if(snippet){}
|
38
|
+
return (
|
39
|
+
<div className={`${backgroundColor} border border-neutral-100 rounded relative`}>
|
40
|
+
{filename ? (
|
41
|
+
<span className='bg-neutral-100 flex p-2 text-sm-medium text-neutral-900'>{filename}</span>
|
42
|
+
) : null}
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
<div className='my-6 mx-10'>
|
45
|
+
<pre style={{ whiteSpace: 'pre-wrap' }} ref={preRef} className='line-numbers'>
|
46
|
+
{lines.map((line, index) => (
|
47
|
+
<code className='language-javascript' key={index}>
|
48
|
+
<span className='text-sm text-neutral-500 mr-4'>{index + 1} </span>
|
49
|
+
{line}
|
50
|
+
{index < lineCount - 1 ? '\n' : null}
|
51
|
+
</code>
|
52
|
+
))}
|
53
|
+
</pre>
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
<button
|
56
|
+
className='border border-neutral-400 button-sm absolute bottom-0 right-0 mb-4 mr-4'
|
57
|
+
onClick={copyToClipboard}
|
58
|
+
>
|
59
|
+
{isCopied ? 'Copied!' : 'Copy to Clipboard'}
|
60
|
+
</button>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
);
|
64
|
+
}
|
65
65
|
|
66
|
-
//
|
67
|
-
//
|
68
|
-
//
|
66
|
+
// CodeSnippetWithCopy.propTypes = {
|
67
|
+
// snippet: PropTypes.string.isRequired,
|
68
|
+
// };
|
69
69
|
|
70
|
-
|
70
|
+
export default CodeSnippetWithCopy;
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export {default as CodeSnippet} from './CodeSnippet';
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
+
import {ReactComponent as HasuraPrimaryIcon } from "../../../assets/icons/HasuraPrimary.svg"
|
3
4
|
import {ReactComponent as ClockrewindIcon } from "../../../assets/icons/clock-rewind.svg"
|
4
5
|
import {ReactComponent as PassportIcon } from "../../../assets/icons/passport.svg"
|
5
6
|
import {ReactComponent as Compass02Icon } from "../../../assets/icons/compass-02.svg"
|
@@ -1175,6 +1176,7 @@ import {ReactComponent as Minus01Icon } from "../../../assets/icons/minus-01.svg
|
|
1175
1176
|
import {ReactComponent as HasuraIcon } from "../../../assets/icons/hasura.svg"
|
1176
1177
|
|
1177
1178
|
const iconReferenceMap = {
|
1179
|
+
hasuraPrimary: HasuraPrimaryIcon,
|
1178
1180
|
hasura: HasuraIcon,
|
1179
1181
|
minus01: Minus01Icon,
|
1180
1182
|
clockrewind: ClockrewindIcon,
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useRef, useEffect } from "react";
|
3
|
+
import { Typography } from "../Typography";
|
4
|
+
import { useState } from "react";
|
5
|
+
import PropTypes from 'prop-types';
|
6
|
+
|
7
|
+
export default function FeatureCard(props) {
|
8
|
+
const [cardHeight, setCardHeight] = useState('auto');
|
9
|
+
const wrapperRef = useRef(null);
|
10
|
+
|
11
|
+
useEffect(() => {
|
12
|
+
if (wrapperRef.current) {
|
13
|
+
// Calculate the max height among all cards
|
14
|
+
const cards = wrapperRef.current.querySelectorAll(".feature-card");
|
15
|
+
if (!cards) return;
|
16
|
+
const heights = Array.from(cards).map((card) => card.clientHeight);
|
17
|
+
const maxHeight = Math.max(...heights);
|
18
|
+
|
19
|
+
// Set the max height as a CSS variable
|
20
|
+
setCardHeight(`${maxHeight}px`);
|
21
|
+
}
|
22
|
+
}, [props.featureCards]);
|
23
|
+
|
24
|
+
return (
|
25
|
+
<div ref={wrapperRef} className="relative card-animation-wrapper max-h-[26.25] max-w-[15rem] tb:max-w-[25rem] tb:max-h-[25.25rem]">
|
26
|
+
{props.featureCards.map((feature, index) => (
|
27
|
+
<div
|
28
|
+
key={index}
|
29
|
+
style={{ height: cardHeight }}
|
30
|
+
className={
|
31
|
+
"feature-card max-w-[18rem] tb:max-w-[21rem] rounded-3xl absolute top-0 left-0 " +
|
32
|
+
(feature.card_bg_color || "")
|
33
|
+
}
|
34
|
+
>
|
35
|
+
<div className="flex justify-center px-6 pt-6 tb:px-8 tb:pt-8 ">
|
36
|
+
<img src={feature.img_url} className='rounded-2xl tb:max-w-[17rem]' alt={feature.title} />
|
37
|
+
</div>
|
38
|
+
<div className={`flex flex-col px-6 pb-6 mt-6 tb:mt-8 tb:px-8 tb:pb-8`}>
|
39
|
+
<Typography
|
40
|
+
textStyle="h5"
|
41
|
+
as="h5"
|
42
|
+
className="text-neutral-0"
|
43
|
+
>
|
44
|
+
{feature.title}
|
45
|
+
</Typography>
|
46
|
+
<Typography textStyle="body1c" className="text-neutral-0 mt-1">
|
47
|
+
{feature.description}
|
48
|
+
</Typography>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
))}
|
52
|
+
</div>
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
FeatureCard.defaultProps ={
|
57
|
+
featureCards : [
|
58
|
+
{
|
59
|
+
img_url: 'https://res.cloudinary.com/dh8fp23nd/image/upload/v1683015500/hasura-con-2023/engage_clgotb.png',
|
60
|
+
title: 'Feature 1',
|
61
|
+
description: 'With hands-on workshops and learning about new tools, tips and tricks from real-life use cases, grow your skill set at HasuraCon.',
|
62
|
+
card_bg_color: 'bg-blue-500',
|
63
|
+
},
|
64
|
+
{
|
65
|
+
img_url: 'https://res.cloudinary.com/dh8fp23nd/image/upload/v1683015500/hasura-con-2023/engage_clgotb.png',
|
66
|
+
title: 'Feature 2',
|
67
|
+
description: 'With hands-on workshops ',
|
68
|
+
card_bg_color: 'bg-red-500',
|
69
|
+
},
|
70
|
+
{
|
71
|
+
img_url: 'https://res.cloudinary.com/dh8fp23nd/image/upload/v1683015500/hasura-con-2023/engage_clgotb.png',
|
72
|
+
title: 'Feature 3',
|
73
|
+
description: 'With hands-on workshops and learning about new tools, tips and tricks from real-life use cases, grow your skill set at HasuraCon.',
|
74
|
+
card_bg_color: 'bg-green-500',
|
75
|
+
},
|
76
|
+
]
|
77
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {default as FeatureCard} from './featureCard';
|
@@ -1,95 +1,73 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
|
+
import { Typography } from '../../foundation/Typography';
|
2
3
|
|
3
|
-
const TimeComponent = ({
|
4
|
+
const TimeComponent = ({ dateTimeString, className }) => {
|
4
5
|
const [currentTime, setCurrentTime] = useState(new Date());
|
6
|
+
const [userTimeZone, setUserTimeZone] = useState('');
|
5
7
|
|
6
8
|
useEffect(() => {
|
7
9
|
const interval = setInterval(() => {
|
8
10
|
setCurrentTime(new Date());
|
9
11
|
}, 1000);
|
12
|
+
|
13
|
+
getUserTimeZone();
|
14
|
+
|
10
15
|
return () => clearInterval(interval);
|
11
16
|
}, []);
|
12
17
|
|
13
|
-
const formatTime = () => {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
}
|
18
|
+
const formatTime = (time, timeZone) => {
|
19
|
+
return time.toLocaleString('en-US', {
|
20
|
+
month: 'long',
|
21
|
+
day: 'numeric',
|
22
|
+
year: 'numeric',
|
23
|
+
hour: 'numeric',
|
24
|
+
minute: 'numeric',
|
25
|
+
hour12: true,
|
26
|
+
timeZone,
|
27
|
+
});
|
59
28
|
};
|
60
29
|
|
61
|
-
const
|
62
|
-
|
63
|
-
|
64
|
-
|
30
|
+
const getUserTimeZone = () => {
|
31
|
+
const getTimeZone = () => {
|
32
|
+
const offset = new Date().getTimezoneOffset();
|
33
|
+
const offsetHours = Math.abs(Math.floor(offset / 60));
|
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
|
+
};
|
65
40
|
|
66
|
-
|
41
|
+
setUserTimeZone(getTimeZone());
|
42
|
+
};
|
67
43
|
|
68
|
-
|
69
|
-
|
44
|
+
const getUserDateTime = () => {
|
45
|
+
if (!dateTimeString) {
|
46
|
+
return null;
|
70
47
|
}
|
71
48
|
|
72
|
-
const
|
73
|
-
|
74
|
-
|
75
|
-
|
49
|
+
const parseDateTime = (dateTimeString) => {
|
50
|
+
const parts = dateTimeString.split('|');
|
51
|
+
const dateString = parts[0].trim();
|
52
|
+
const timeString = parts[1].trim();
|
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
|
+
};
|
76
59
|
|
77
|
-
|
78
|
-
|
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
|
-
);
|
60
|
+
const userDateTime = parseDateTime(dateTimeString);
|
61
|
+
return userDateTime;
|
87
62
|
};
|
88
63
|
|
89
64
|
return (
|
90
65
|
<div>
|
91
|
-
<div
|
92
|
-
|
66
|
+
<div className={className}>
|
67
|
+
<Typography textStyle='h6'>
|
68
|
+
{getUserDateTime() || formatTime(currentTime, userTimeZone)}
|
69
|
+
</Typography>
|
70
|
+
</div>
|
93
71
|
</div>
|
94
72
|
);
|
95
73
|
};
|
package/src/index.css
CHANGED
@@ -3,6 +3,160 @@
|
|
3
3
|
@tailwind utilities;
|
4
4
|
/* Typography classes */
|
5
5
|
|
6
|
+
.card-animation-wrapper {
|
7
|
+
position: relative;
|
8
|
+
}
|
9
|
+
|
10
|
+
.card-animation-wrapper .feature-card {
|
11
|
+
transition: all;
|
12
|
+
}
|
13
|
+
|
14
|
+
.card-animation-wrapper .feature-card:first-child {
|
15
|
+
animation: card1 15s infinite;
|
16
|
+
}
|
17
|
+
|
18
|
+
.card-animation-wrapper .feature-card:nth-child(2) {
|
19
|
+
animation: card2 15s infinite;
|
20
|
+
}
|
21
|
+
|
22
|
+
.card-animation-wrapper .feature-card:nth-child(3) {
|
23
|
+
animation: card3 15s infinite;
|
24
|
+
}
|
25
|
+
@keyframes card1 {
|
26
|
+
0% {
|
27
|
+
transform: translate(0, 0);
|
28
|
+
z-index: 3;
|
29
|
+
}
|
30
|
+
0.1%,6.65% {
|
31
|
+
z-index: 3;
|
32
|
+
}
|
33
|
+
6.66%, 26.64% {
|
34
|
+
transform: translate(4rem, 4rem);
|
35
|
+
z-index: 2;
|
36
|
+
}
|
37
|
+
33.3%, 59.94% {
|
38
|
+
transform: translate(2rem, 2rem);
|
39
|
+
z-index: 1;
|
40
|
+
}
|
41
|
+
66.6%, 100% {
|
42
|
+
transform: translate(0, 0);
|
43
|
+
z-index: 0;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
@media (max-width: 600px) {
|
48
|
+
@keyframes card1 {
|
49
|
+
0% {
|
50
|
+
transform: translate(0, 0);
|
51
|
+
z-index: 3;
|
52
|
+
}
|
53
|
+
0.1%,6.65% {
|
54
|
+
z-index: 3;
|
55
|
+
}
|
56
|
+
6.66%, 26.64% {
|
57
|
+
transform: translate(3rem, 3rem);
|
58
|
+
z-index: 2;
|
59
|
+
}
|
60
|
+
33.3%, 59.94% {
|
61
|
+
transform: translate(1.5rem, 1.5rem);
|
62
|
+
z-index: 1;
|
63
|
+
}
|
64
|
+
66.6%, 100% {
|
65
|
+
transform: translate(0, 0);
|
66
|
+
z-index: 0;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
@keyframes card2 {
|
71
|
+
0% {
|
72
|
+
transform: translate(2rem, 2rem);
|
73
|
+
z-index: 1;
|
74
|
+
}
|
75
|
+
6.66%, 26.64% {
|
76
|
+
transform: translate(0px, 0px);
|
77
|
+
z-index: 0;
|
78
|
+
}
|
79
|
+
26.65%,33.29% {
|
80
|
+
z-index: 2;
|
81
|
+
}
|
82
|
+
33.3%, 59.94% {
|
83
|
+
transform: translate(4rem, 4rem);
|
84
|
+
z-index: 2;
|
85
|
+
}
|
86
|
+
66.6%, 100% {
|
87
|
+
transform: translate(2rem, 2rem);
|
88
|
+
z-index: 1;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
@media (max-width: 600px) {
|
93
|
+
@keyframes card2 {
|
94
|
+
0% {
|
95
|
+
transform: translate(1.5rem, 1.5rem);
|
96
|
+
z-index: 1;
|
97
|
+
}
|
98
|
+
6.66%, 26.64% {
|
99
|
+
transform: translate(0px, 0px);
|
100
|
+
z-index: 0;
|
101
|
+
}
|
102
|
+
26.65%,33.29% {
|
103
|
+
z-index: 2;
|
104
|
+
}
|
105
|
+
33.3%, 59.94% {
|
106
|
+
transform: translate(3rem, 3rem);
|
107
|
+
z-index: 2;
|
108
|
+
}
|
109
|
+
66.6%, 100% {
|
110
|
+
transform: translate(1.5rem, 1.5rem);
|
111
|
+
z-index: 1;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
@keyframes card3 {
|
116
|
+
0% {
|
117
|
+
transform: translate(4rem, 4rem);
|
118
|
+
z-index: 2;
|
119
|
+
}
|
120
|
+
6.66%, 26.64% {
|
121
|
+
transform: translate(2rem, 2rem);
|
122
|
+
z-index: 1;
|
123
|
+
}
|
124
|
+
33.3%, 59.94% {
|
125
|
+
transform: translate(0px, 0px);
|
126
|
+
z-index: 0;
|
127
|
+
}
|
128
|
+
59.95%,66.5% {
|
129
|
+
z-index: 2;
|
130
|
+
}
|
131
|
+
66.6%, 100% {
|
132
|
+
transform: translate(4rem, 4rem);
|
133
|
+
z-index: 2;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
@media (max-width: 600px) {
|
137
|
+
@keyframes card3 {
|
138
|
+
0% {
|
139
|
+
transform: translate(3rem, 3rem);
|
140
|
+
z-index: 2;
|
141
|
+
}
|
142
|
+
6.66%, 26.64% {
|
143
|
+
transform: translate(1.5rem, 1.5rem);
|
144
|
+
z-index: 1;
|
145
|
+
}
|
146
|
+
33.3%, 59.94% {
|
147
|
+
transform: translate(0px, 0px);
|
148
|
+
z-index: 0;
|
149
|
+
}
|
150
|
+
59.95%,66.5% {
|
151
|
+
z-index: 2;
|
152
|
+
}
|
153
|
+
66.6%, 100% {
|
154
|
+
transform: translate(3rem, 3rem);
|
155
|
+
z-index: 2;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
6
160
|
.scrollbar-hide::-webkit-scrollbar {
|
7
161
|
width: 0;
|
8
162
|
height: 0;
|