@sikka/hawa 0.0.264 → 0.0.266
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/styles.css +77 -10
- package/es/elements/HawaAlert.d.ts +2 -0
- package/es/elements/HawaButton.d.ts +3 -1
- package/es/elements/HawaCodeBlock.d.ts +1 -0
- package/es/elements/HawaInlineCode.d.ts +6 -0
- package/es/elements/Timeline.d.ts +13 -0
- package/es/elements/index.d.ts +6 -4
- package/es/index.es.js +3 -3
- package/es/layout/HawaAppLayoutSimplified.d.ts +2 -0
- package/lib/elements/HawaAlert.d.ts +2 -0
- package/lib/elements/HawaButton.d.ts +3 -1
- package/lib/elements/HawaCodeBlock.d.ts +1 -0
- package/lib/elements/HawaInlineCode.d.ts +6 -0
- package/lib/elements/Timeline.d.ts +13 -0
- package/lib/elements/index.d.ts +6 -4
- package/lib/index.js +3 -3
- package/lib/layout/HawaAppLayoutSimplified.d.ts +2 -0
- package/package.json +2 -1
- package/src/elements/HawaAlert.tsx +73 -51
- package/src/elements/HawaButton.tsx +97 -49
- package/src/elements/HawaCodeBlock.tsx +68 -19
- package/src/elements/HawaInlineCode.tsx +9 -0
- package/src/elements/HawaMenu.tsx +2 -2
- package/src/elements/Timeline.tsx +35 -0
- package/src/elements/index.ts +6 -4
- package/src/layout/HawaAppLayoutSimplified.tsx +98 -82
- package/src/styles.css +77 -10
- package/src/tailwind.css +18 -0
- package/es/stories/ElementsStories/Buttons.stories.d.ts +0 -24
- package/lib/stories/ElementsStories/Buttons.stories.d.ts +0 -24
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
type HawaAppLayoutTypes = {
|
|
3
|
+
/** The pages of the side drawer */
|
|
3
4
|
drawerItems: {
|
|
4
5
|
label: string;
|
|
5
6
|
icon: any;
|
|
@@ -20,6 +21,7 @@ type HawaAppLayoutTypes = {
|
|
|
20
21
|
drawerSize?: "sm" | "md" | "large";
|
|
21
22
|
profileMenuItems?: MenuItems[][];
|
|
22
23
|
onSettingsClick?: () => void;
|
|
24
|
+
DrawerFooterActions: any;
|
|
23
25
|
};
|
|
24
26
|
type MenuItems = {
|
|
25
27
|
icon?: JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.266",
|
|
4
4
|
"description": "SaaS Oriented UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"kit",
|
|
12
12
|
"saas",
|
|
13
13
|
"kit",
|
|
14
|
+
"tailwind",
|
|
14
15
|
"hawa"
|
|
15
16
|
],
|
|
16
17
|
"repository": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
import { HawaButton } from "./HawaButton"
|
|
4
|
+
import { FiAlertCircle } from "react-icons/fi"
|
|
4
5
|
|
|
5
6
|
type AlertTypes = {
|
|
6
7
|
severity: "info" | "warning" | "error" | "success"
|
|
@@ -10,7 +11,6 @@ type AlertTypes = {
|
|
|
10
11
|
text: any
|
|
11
12
|
/** The duration for the alert to stay on the screen */
|
|
12
13
|
duration?: number
|
|
13
|
-
// hideIcon?: any //TODO: an X button to delete the alert
|
|
14
14
|
variant?:
|
|
15
15
|
| "normal"
|
|
16
16
|
| "solid"
|
|
@@ -26,11 +26,14 @@ type AlertTypes = {
|
|
|
26
26
|
variant: "contained" | "outlined"
|
|
27
27
|
}
|
|
28
28
|
]
|
|
29
|
+
persistant?: boolean
|
|
30
|
+
icon?: any
|
|
29
31
|
}
|
|
30
32
|
export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
31
33
|
variant = "normal",
|
|
32
34
|
direction = "ltr",
|
|
33
35
|
duration,
|
|
36
|
+
icon,
|
|
34
37
|
...props
|
|
35
38
|
}) => {
|
|
36
39
|
const alertRef = useRef(null)
|
|
@@ -55,6 +58,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
55
58
|
}
|
|
56
59
|
}, [duration])
|
|
57
60
|
let closeButtonStyle = {
|
|
61
|
+
none: "hover:bg-gray-300",
|
|
58
62
|
info: "hover:bg-blue-300",
|
|
59
63
|
warning: "hover:bg-yellow-300",
|
|
60
64
|
error: "hover:bg-red-300",
|
|
@@ -62,6 +66,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
62
66
|
}
|
|
63
67
|
let styleVariant = {
|
|
64
68
|
normal: {
|
|
69
|
+
none: "text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
|
|
65
70
|
info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
66
71
|
warning:
|
|
67
72
|
"text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
@@ -70,6 +75,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
70
75
|
"text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
71
76
|
},
|
|
72
77
|
"top-accent": {
|
|
78
|
+
none: "border-t-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
|
|
73
79
|
info: "border-t-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
74
80
|
warning:
|
|
75
81
|
"border-t-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
@@ -79,6 +85,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
79
85
|
"border-t-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
80
86
|
},
|
|
81
87
|
"left-accent": {
|
|
88
|
+
none: "border-l-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
|
|
82
89
|
info: "border-l-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
83
90
|
warning:
|
|
84
91
|
"border-l-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
@@ -88,6 +95,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
88
95
|
"border-l-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
89
96
|
},
|
|
90
97
|
"right-accent": {
|
|
98
|
+
none: "border-r-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
|
|
91
99
|
info: "border-r-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
92
100
|
warning:
|
|
93
101
|
"border-r-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
@@ -97,6 +105,7 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
97
105
|
"border-r-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
98
106
|
},
|
|
99
107
|
"bottom-accent": {
|
|
108
|
+
none: "border-b-4 border-gray-300 text-gray-700 bg-gray-100 dark:bg-gray-200 dark:text-gray-800",
|
|
100
109
|
info: "border-b-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
101
110
|
warning:
|
|
102
111
|
"border-b-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
@@ -117,58 +126,71 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
|
117
126
|
role="alert"
|
|
118
127
|
dir={direction}
|
|
119
128
|
>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<span>{" " + props.text}</span>
|
|
126
|
-
|
|
127
|
-
{props.actions && (
|
|
128
|
-
<div className="mt-2 flex flex-row gap-2">
|
|
129
|
-
{props.actions.map((act, index) => (
|
|
130
|
-
<HawaButton
|
|
131
|
-
key={index}
|
|
132
|
-
variant={act.variant}
|
|
133
|
-
onClick={act.onClick()}
|
|
134
|
-
margins="none"
|
|
135
|
-
>
|
|
136
|
-
{act.label}
|
|
137
|
-
</HawaButton>
|
|
138
|
-
))}
|
|
139
|
-
</div>
|
|
140
|
-
)}
|
|
141
|
-
<button
|
|
142
|
-
type="button"
|
|
143
|
-
className={clsx(
|
|
144
|
-
"absolute top-2 inline-flex h-9 w-9 items-center justify-center rounded-inner p-1.5 text-gray-400 transition-all hover:text-gray-900 focus:ring-2 focus:ring-gray-300 dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white",
|
|
145
|
-
closeButtonStyle[props.severity],
|
|
146
|
-
direction === "rtl" ? "left-2" : "right-2"
|
|
129
|
+
<div className="flex flex-row">
|
|
130
|
+
{icon && (
|
|
131
|
+
<div className={direction === "rtl" ? "pl-2 pt-1" : "pr-2 pt-1"}>
|
|
132
|
+
{icon}
|
|
133
|
+
</div>
|
|
147
134
|
)}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
135
|
+
<div className="flex flex-col">
|
|
136
|
+
<span
|
|
137
|
+
className={clsx(
|
|
138
|
+
"font-medium",
|
|
139
|
+
direction === "rtl" ? "ml-8" : "mr-8"
|
|
140
|
+
)}
|
|
141
|
+
>
|
|
142
|
+
{props.title}
|
|
143
|
+
</span>
|
|
144
|
+
<span>{" " + props.text}</span>
|
|
145
|
+
{props.actions && (
|
|
146
|
+
<div className="mt-2 flex flex-row gap-2">
|
|
147
|
+
{props.actions.map((act, index) => (
|
|
148
|
+
<HawaButton
|
|
149
|
+
key={index}
|
|
150
|
+
variant={act.variant}
|
|
151
|
+
onClick={act.onClick()}
|
|
152
|
+
margins="none"
|
|
153
|
+
>
|
|
154
|
+
{act.label}
|
|
155
|
+
</HawaButton>
|
|
156
|
+
))}
|
|
157
|
+
</div>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
{!props.persistant && (
|
|
162
|
+
<button
|
|
163
|
+
type="button"
|
|
164
|
+
className={clsx(
|
|
165
|
+
"absolute top-2 inline-flex h-9 w-9 items-center justify-center rounded-inner p-1.5 text-gray-400 transition-all hover:text-gray-900 focus:ring-2 focus:ring-gray-300 dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white",
|
|
166
|
+
closeButtonStyle[props.severity],
|
|
167
|
+
direction === "rtl" ? "left-2" : "right-2"
|
|
168
|
+
)}
|
|
169
|
+
data-dismiss-target="#alert-default"
|
|
170
|
+
aria-label="Close"
|
|
171
|
+
onClick={() => {
|
|
172
|
+
setClosed(true)
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
alertRef.current.removeChild(alertRef.current.children[0])
|
|
175
|
+
}, 200)
|
|
176
|
+
}}
|
|
164
177
|
>
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
178
|
+
<span className="sr-only">Close</span>
|
|
179
|
+
<svg
|
|
180
|
+
aria-hidden="true"
|
|
181
|
+
className="h-5 w-5"
|
|
182
|
+
fill="currentColor"
|
|
183
|
+
viewBox="0 0 20 20"
|
|
184
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
185
|
+
>
|
|
186
|
+
<path
|
|
187
|
+
fillRule="evenodd"
|
|
188
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
189
|
+
clipRule="evenodd"
|
|
190
|
+
></path>
|
|
191
|
+
</svg>
|
|
192
|
+
</button>
|
|
193
|
+
)}
|
|
172
194
|
</div>
|
|
173
195
|
</div>
|
|
174
196
|
)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React, { FC, ButtonHTMLAttributes } from "react"
|
|
1
|
+
import React, { FC, ButtonHTMLAttributes, useState } from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
3
|
import { HawaSpinner } from "./HawaSpinner"
|
|
4
4
|
import { HawaTooltip } from "./HawaTooltip"
|
|
5
5
|
|
|
6
6
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
7
|
variant?: "contained" | "outlined"
|
|
8
|
+
feedback?: string
|
|
8
9
|
tooltipDirection?: "rtl" | "ltr"
|
|
9
|
-
color?: "default" | "primary" | "secondary"
|
|
10
|
+
color?: "default" | "primary" | "secondary" | "light" | "dark"
|
|
10
11
|
width?: "full" | "normal" | "half"
|
|
11
12
|
size?: "xs" | "small" | "medium" | "large" | "noPadding" | "full"
|
|
12
13
|
margins?: "none" | "1" | "2" | "3" | "4"
|
|
@@ -25,6 +26,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
25
26
|
endIcon?: any
|
|
26
27
|
isLoading?: boolean
|
|
27
28
|
badge?: any
|
|
29
|
+
edgeCorner?: any
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
const disabledSyles = "cursor-default pointer-events-none"
|
|
@@ -32,6 +34,51 @@ const disabledVariantSyles = {
|
|
|
32
34
|
contained: "text-gray-300 bg-gray-100",
|
|
33
35
|
outlined: "text-gray-300 border-gray-300",
|
|
34
36
|
}
|
|
37
|
+
const baseStyles =
|
|
38
|
+
"cursor-pointer h-[2.36rem] justify-center items-center text-center font-medium transition-all"
|
|
39
|
+
const sizeStyles = {
|
|
40
|
+
xs: "px-1 py-1",
|
|
41
|
+
small: "text-xs px-2.5 py-1.5",
|
|
42
|
+
medium: "text-sm leading-4 px-3 py-2",
|
|
43
|
+
large: "text-sm px-4 py-2",
|
|
44
|
+
noPadding: "p-0",
|
|
45
|
+
full: "h-full max-h-full p-2",
|
|
46
|
+
}
|
|
47
|
+
const widthStyles = {
|
|
48
|
+
full: "w-full flex justify-center px-5 py-2.5 text-center inline-flex items-center",
|
|
49
|
+
half: "w-full text-center flex items-center justify-center h-full",
|
|
50
|
+
normal:
|
|
51
|
+
"w-fit dark:bg-buttonPrimary-dark dark:hover:bg-buttonPrimary-700 dark:hover:brightness-90 dark:focus:ring-buttonPrimary-500",
|
|
52
|
+
}
|
|
53
|
+
const containerWidthStyles = {
|
|
54
|
+
full: "w-full flex justify-center text-center inline-flex items-center",
|
|
55
|
+
half: "w-1/2",
|
|
56
|
+
normal: "w-fit",
|
|
57
|
+
}
|
|
58
|
+
const variantStyles = {
|
|
59
|
+
contained: "border-transparent",
|
|
60
|
+
outlined: "bg-transparent border",
|
|
61
|
+
}
|
|
62
|
+
const colorStyles = {
|
|
63
|
+
contained: {
|
|
64
|
+
default:
|
|
65
|
+
"text-neutral-900 bg-buttonPrimary-500 hover:bg-buttonPrimary-700 bg-buttonPrimary-500 text-white",
|
|
66
|
+
primary:
|
|
67
|
+
"text-white bg-buttonPrimary-500 hover:bg-buttonPrimary-700 transition-all",
|
|
68
|
+
secondary:
|
|
69
|
+
"bg-buttonSecondary-500 hover:text-white hover:bg-buttonSecondary-700",
|
|
70
|
+
gray: "text-neutral-900 bg-gray-200 hover:bg-gray-300",
|
|
71
|
+
dark: "text-neutral-900 bg-gray-200 hover:bg-gray-300",
|
|
72
|
+
},
|
|
73
|
+
outlined: {
|
|
74
|
+
default: "text-gray-600 border-gray-600 hover:bg-gray-200",
|
|
75
|
+
primary: "text-black hover:bg-gray-50",
|
|
76
|
+
secondary:
|
|
77
|
+
"text-secondary-800 border-secondary-800 hover:bg-buttonSecondary-700 hover:text-white",
|
|
78
|
+
gray: "border-gray-300 hover:bg-gray-200 ",
|
|
79
|
+
dark: "border-gray-900 hover:bg-gray-700 ",
|
|
80
|
+
},
|
|
81
|
+
}
|
|
35
82
|
|
|
36
83
|
export const HawaButton: FC<ButtonProps> = ({
|
|
37
84
|
className,
|
|
@@ -48,51 +95,30 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
48
95
|
margins = "2",
|
|
49
96
|
children,
|
|
50
97
|
badge,
|
|
98
|
+
edgeCorner = false,
|
|
99
|
+
feedback,
|
|
51
100
|
...props
|
|
52
101
|
}) => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const sizeStyles = {
|
|
57
|
-
xs: "px-1 py-1",
|
|
58
|
-
small: "text-xs px-2.5 py-1.5",
|
|
59
|
-
medium: "text-sm leading-4 px-3 py-2",
|
|
60
|
-
large: "text-sm px-4 py-2",
|
|
61
|
-
noPadding: "p-0",
|
|
62
|
-
full: "h-full max-h-full p-2",
|
|
63
|
-
}
|
|
102
|
+
const [isClicked, setIsClicked] = useState(false)
|
|
103
|
+
const [buttonText, setButtonText] = useState(children)
|
|
64
104
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
contained: {
|
|
83
|
-
default:
|
|
84
|
-
"text-neutral-900 bg-buttonPrimary-500 hover:bg-buttonPrimary-700 bg-buttonPrimary-500 text-white",
|
|
85
|
-
primary:
|
|
86
|
-
"text-white bg-buttonPrimary-500 hover:bg-buttonPrimary-700 transition-all",
|
|
87
|
-
secondary:
|
|
88
|
-
"text-neutral-900 bg-buttonSecondary-default hover:text-white hover:bg-buttonSecondary-700",
|
|
89
|
-
},
|
|
90
|
-
outlined: {
|
|
91
|
-
default: "text-gray-600 border-gray-600 hover:bg-gray-200",
|
|
92
|
-
primary: "text-black hover:bg-gray-50",
|
|
93
|
-
secondary:
|
|
94
|
-
"text-secondary-800 border-secondary-800 hover:bg-buttonSecondary-700 hover:text-white",
|
|
95
|
-
},
|
|
105
|
+
const handleClick = () => {
|
|
106
|
+
if (feedback) {
|
|
107
|
+
if (!isClicked) {
|
|
108
|
+
props.onClick
|
|
109
|
+
setButtonText(feedback)
|
|
110
|
+
setIsClicked(true)
|
|
111
|
+
console.log("hawa button clicked")
|
|
112
|
+
// Reset the button text after 2 seconds (adjust the time as needed).
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
setButtonText(children)
|
|
115
|
+
setIsClicked(false)
|
|
116
|
+
}, 2000)
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
props.onClick(null)
|
|
120
|
+
console.log("hawa button clicked")
|
|
121
|
+
}
|
|
96
122
|
}
|
|
97
123
|
|
|
98
124
|
return (
|
|
@@ -116,6 +142,8 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
116
142
|
? clsx(
|
|
117
143
|
className,
|
|
118
144
|
baseStyles,
|
|
145
|
+
edgeCorner ? "rounded-inner" : "rounded",
|
|
146
|
+
|
|
119
147
|
variantStyles[variant],
|
|
120
148
|
sizeStyles[size],
|
|
121
149
|
widthStyles[width],
|
|
@@ -125,6 +153,8 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
125
153
|
: clsx(
|
|
126
154
|
className,
|
|
127
155
|
baseStyles,
|
|
156
|
+
edgeCorner ? "rounded-inner" : "rounded",
|
|
157
|
+
|
|
128
158
|
variantStyles[variant],
|
|
129
159
|
sizeStyles[size],
|
|
130
160
|
colorStyles[variant][color],
|
|
@@ -133,6 +163,7 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
133
163
|
}
|
|
134
164
|
disabled={disabled}
|
|
135
165
|
onClick={props.onClick}
|
|
166
|
+
// onClick={handleClick}
|
|
136
167
|
>
|
|
137
168
|
{!isLoading ? children : <HawaSpinner size="button" />}
|
|
138
169
|
</button>
|
|
@@ -144,6 +175,8 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
144
175
|
? clsx(
|
|
145
176
|
className,
|
|
146
177
|
baseStyles,
|
|
178
|
+
edgeCorner ? "rounded-inner" : "rounded",
|
|
179
|
+
|
|
147
180
|
variantStyles[variant],
|
|
148
181
|
sizeStyles[size],
|
|
149
182
|
widthStyles[width],
|
|
@@ -152,7 +185,9 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
152
185
|
)
|
|
153
186
|
: clsx(
|
|
154
187
|
className,
|
|
188
|
+
"overflow-x-clip",
|
|
155
189
|
baseStyles,
|
|
190
|
+
edgeCorner ? "rounded-inner" : "rounded",
|
|
156
191
|
variantStyles[variant],
|
|
157
192
|
sizeStyles[size],
|
|
158
193
|
colorStyles[variant][color],
|
|
@@ -160,13 +195,26 @@ export const HawaButton: FC<ButtonProps> = ({
|
|
|
160
195
|
)
|
|
161
196
|
}
|
|
162
197
|
disabled={disabled}
|
|
163
|
-
onClick={props.onClick}
|
|
198
|
+
// onClick={props.onClick}
|
|
199
|
+
onClick={handleClick}
|
|
164
200
|
>
|
|
165
201
|
{!isLoading ? (
|
|
166
|
-
<div
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
|
|
202
|
+
<div
|
|
203
|
+
className={clsx(
|
|
204
|
+
" s flex flex-col-reverse items-start justify-center gap-4 transition-all",
|
|
205
|
+
isClicked && feedback
|
|
206
|
+
? " -translate-y-8 pb-1 pt-1"
|
|
207
|
+
: "translate-y-0"
|
|
208
|
+
)}
|
|
209
|
+
>
|
|
210
|
+
{isClicked && feedback ? (
|
|
211
|
+
<div className="w-full text-center">{buttonText}</div>
|
|
212
|
+
) : null}
|
|
213
|
+
<div className="flex w-full flex-row items-center justify-center gap-2 whitespace-nowrap">
|
|
214
|
+
{props.startIcon && props.startIcon}
|
|
215
|
+
{children}
|
|
216
|
+
{props.endIcon && props.endIcon}
|
|
217
|
+
</div>
|
|
170
218
|
</div>
|
|
171
219
|
) : (
|
|
172
220
|
<HawaSpinner size="button" />
|
|
@@ -7,6 +7,7 @@ type CodeBlockTypes = {
|
|
|
7
7
|
language?: string
|
|
8
8
|
width?: "full" | "md" | "sm"
|
|
9
9
|
tabs?: TabsTypes[]
|
|
10
|
+
fileName?: string
|
|
10
11
|
code?: string
|
|
11
12
|
}
|
|
12
13
|
type TabsTypes = {
|
|
@@ -18,21 +19,34 @@ export const HawaCodeBlock: FC<CodeBlockTypes> = ({
|
|
|
18
19
|
tabs,
|
|
19
20
|
language,
|
|
20
21
|
code,
|
|
22
|
+
fileName,
|
|
21
23
|
width = "full",
|
|
22
24
|
}) => {
|
|
23
25
|
const [selectedTab, setSelectedTab] = useState(0)
|
|
24
26
|
const [showTooltip, setShowTooltip] = useState(0)
|
|
27
|
+
const [copyClicked, setCopyClicked] = useState(false)
|
|
25
28
|
let widthStyles = {
|
|
26
29
|
full: "w-full",
|
|
27
30
|
md: "w-full max-w-md",
|
|
28
31
|
sm: "w-full max-w-sm",
|
|
29
32
|
xs: "w-full max-w-xs",
|
|
30
33
|
}
|
|
34
|
+
|
|
35
|
+
const handleCopyClick = () => {
|
|
36
|
+
if (!copyClicked) {
|
|
37
|
+
setCopyClicked(true)
|
|
38
|
+
console.log("copy button clicked")
|
|
39
|
+
// Reset the button text after 2 seconds (adjust the time as needed).
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
setCopyClicked(false)
|
|
42
|
+
}, 2000)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
return (
|
|
32
46
|
<div
|
|
33
47
|
className={clsx(
|
|
34
48
|
widthStyles[width],
|
|
35
|
-
"w-full flex-col items-center
|
|
49
|
+
"w-full flex-col items-center rounded bg-gray-800 text-left text-sm text-white sm:text-base"
|
|
36
50
|
)}
|
|
37
51
|
>
|
|
38
52
|
{" "}
|
|
@@ -58,36 +72,71 @@ export const HawaCodeBlock: FC<CodeBlockTypes> = ({
|
|
|
58
72
|
))}
|
|
59
73
|
</div>
|
|
60
74
|
)}
|
|
75
|
+
{fileName && (
|
|
76
|
+
<div className="flex flex-row gap-2 rounded-t bg-gray-700 p-2 pb-0">
|
|
77
|
+
<div
|
|
78
|
+
// className={clsx(
|
|
79
|
+
// selectedTab === i
|
|
80
|
+
// ? "border-buttonPrimary-400 border-b-2"
|
|
81
|
+
// : "bg-transparent"
|
|
82
|
+
// )}
|
|
83
|
+
>
|
|
84
|
+
<div
|
|
85
|
+
className={clsx(
|
|
86
|
+
"mb-1 w-full max-w-[52px] rounded-inner p-2 py-1 text-center text-[0.75rem] "
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
{fileName}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
)}
|
|
61
94
|
<pre>
|
|
62
95
|
<code
|
|
63
96
|
className={clsx(
|
|
64
|
-
"flex flex-row items-start justify-between rounded bg-gray-800
|
|
97
|
+
"flex w-full flex-row items-start justify-between rounded bg-gray-800 p-2 text-left text-sm text-white sm:text-base"
|
|
65
98
|
// `language-${language}`,
|
|
66
|
-
tabs ? "" : "pl-4"
|
|
67
99
|
)}
|
|
68
100
|
>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
101
|
+
<div className="flex min-h-[37.75px] w-full flex-col justify-center p-4 ">
|
|
102
|
+
{tabs ? tabs[selectedTab].code : code}
|
|
103
|
+
</div>
|
|
104
|
+
<div className="flex flex-row items-center gap-2 p-2">
|
|
105
|
+
<div
|
|
106
|
+
className={clsx(
|
|
107
|
+
"transition-all",
|
|
108
|
+
copyClicked ? "opacity-100" : "opacity-0"
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
Copied!
|
|
112
|
+
</div>
|
|
113
|
+
<HawaButton
|
|
114
|
+
variant="outlined"
|
|
115
|
+
color="dark"
|
|
72
116
|
onClick={() => {
|
|
117
|
+
handleCopyClick()
|
|
73
118
|
navigator.clipboard.writeText(
|
|
74
119
|
tabs ? tabs[selectedTab].code : code
|
|
75
120
|
)
|
|
76
121
|
}}
|
|
77
|
-
|
|
78
|
-
fill="none"
|
|
79
|
-
stroke-width="2"
|
|
80
|
-
viewBox="0 0 24 24"
|
|
81
|
-
stroke-linecap="round"
|
|
82
|
-
stroke-linejoin="round"
|
|
83
|
-
height="1em"
|
|
84
|
-
width="1em"
|
|
85
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
122
|
+
margins="none"
|
|
86
123
|
>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
124
|
+
<svg
|
|
125
|
+
stroke="currentColor"
|
|
126
|
+
fill="none"
|
|
127
|
+
stroke-width="2"
|
|
128
|
+
viewBox="0 0 24 24"
|
|
129
|
+
stroke-linecap="round"
|
|
130
|
+
stroke-linejoin="round"
|
|
131
|
+
height="1em"
|
|
132
|
+
width="1em"
|
|
133
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
134
|
+
>
|
|
135
|
+
<rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect>
|
|
136
|
+
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>
|
|
137
|
+
</svg>
|
|
138
|
+
</HawaButton>
|
|
139
|
+
</div>
|
|
91
140
|
</code>
|
|
92
141
|
</pre>
|
|
93
142
|
{/* {tabs.map((tab) => (
|
|
@@ -197,10 +197,10 @@ export const HawaMenu: FC<TMenuTypes> = ({
|
|
|
197
197
|
className={clsx(
|
|
198
198
|
"transition-all",
|
|
199
199
|
item.isButton
|
|
200
|
-
? "flex cursor-pointer flex-row items-center rounded bg-buttonPrimary-500 px-4 py-2 text-white hover:bg-buttonPrimary-700 rtl:flex-row-reverse"
|
|
200
|
+
? "flex cursor-pointer flex-row items-center rounded-inner bg-buttonPrimary-500 px-4 py-2 text-white hover:bg-buttonPrimary-700 rtl:flex-row-reverse"
|
|
201
201
|
: item.disabled
|
|
202
202
|
? "text-gray-300"
|
|
203
|
-
: " flex cursor-pointer flex-row items-center rounded hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white ",
|
|
203
|
+
: " flex cursor-pointer flex-row items-center rounded-inner hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white ",
|
|
204
204
|
sizeStyles[size]
|
|
205
205
|
)}
|
|
206
206
|
>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { FC } from "react"
|
|
2
|
+
|
|
3
|
+
type TimelineTypes = {
|
|
4
|
+
title: any
|
|
5
|
+
steps: StepTypes[]
|
|
6
|
+
}
|
|
7
|
+
type StepTypes = {
|
|
8
|
+
date: string
|
|
9
|
+
title: string
|
|
10
|
+
description?: string
|
|
11
|
+
actions?: any
|
|
12
|
+
}
|
|
13
|
+
export const Timeline: FC<TimelineTypes> = (props) => {
|
|
14
|
+
return (
|
|
15
|
+
<div>
|
|
16
|
+
<ol className="relative border-l border-gray-200 dark:border-gray-700">
|
|
17
|
+
{props.steps.map((step) => (
|
|
18
|
+
<li className="mb-10 ml-4">
|
|
19
|
+
<div className="absolute -left-1.5 mt-1.5 h-3 w-3 rounded-full border border-white bg-gray-200 dark:border-gray-900 dark:bg-gray-700"></div>
|
|
20
|
+
<time className="mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">
|
|
21
|
+
{step.date}
|
|
22
|
+
</time>
|
|
23
|
+
<h3 className="text-lg font-semibold text-gray-900 dark:text-white">
|
|
24
|
+
{step.title}
|
|
25
|
+
</h3>
|
|
26
|
+
<p className="mb-4 text-base font-normal text-gray-500 dark:text-gray-400">
|
|
27
|
+
{step.description}
|
|
28
|
+
</p>
|
|
29
|
+
{step.actions}
|
|
30
|
+
</li>
|
|
31
|
+
))}
|
|
32
|
+
</ol>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|