catchup-library-web 2.6.11 → 2.6.13
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.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +717 -659
- package/dist/index.mjs +670 -613
- package/package.json +1 -1
- package/src/components/buttons/StartButton.tsx +67 -0
- package/src/index.ts +1 -0
- package/src/properties/ButtonProperties.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import BaseLoading from "../loading/BaseLoading";
|
|
3
|
+
import { IButtonProps } from "../../properties/ButtonProperties";
|
|
4
|
+
|
|
5
|
+
const StartButton = ({
|
|
6
|
+
title,
|
|
7
|
+
size,
|
|
8
|
+
onClick,
|
|
9
|
+
disabled,
|
|
10
|
+
icon,
|
|
11
|
+
}: IButtonProps) => {
|
|
12
|
+
const [loading, setLoading] = useState(false);
|
|
13
|
+
|
|
14
|
+
const internalOnClick = async (e: any) => {
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
if (loading) return;
|
|
17
|
+
if (disabled) return;
|
|
18
|
+
setLoading(true);
|
|
19
|
+
await onClick();
|
|
20
|
+
setLoading(false);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let currentHeightClassName;
|
|
24
|
+
let currentLoadingSize;
|
|
25
|
+
if (size === "small") {
|
|
26
|
+
currentHeightClassName = "h-10";
|
|
27
|
+
currentLoadingSize = 16;
|
|
28
|
+
} else if (size === "medium") {
|
|
29
|
+
currentHeightClassName = "h-12";
|
|
30
|
+
currentLoadingSize = 18;
|
|
31
|
+
} else if (size === "large") {
|
|
32
|
+
currentHeightClassName = "h-14";
|
|
33
|
+
currentLoadingSize = 20;
|
|
34
|
+
} else if (size === "unlimited") {
|
|
35
|
+
currentHeightClassName = "h-10";
|
|
36
|
+
currentLoadingSize = 16;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<button
|
|
41
|
+
className={`px-8 py-2 bg-gradient-to-r from-catchup-green to-catchup-hover-green text-catchup-white font-bold text-lg rounded-catchup-full shadow-card ${
|
|
42
|
+
loading
|
|
43
|
+
? ""
|
|
44
|
+
: disabled
|
|
45
|
+
? "opacity-50"
|
|
46
|
+
: "hover:from-catchup-hover-green hover:to-catchup-green hover:shadow-full-card hover:scale-105"
|
|
47
|
+
} transition-all duration-300 transform ${currentHeightClassName || ""}`}
|
|
48
|
+
onClick={internalOnClick}
|
|
49
|
+
>
|
|
50
|
+
{loading ? (
|
|
51
|
+
<BaseLoading
|
|
52
|
+
height={currentLoadingSize}
|
|
53
|
+
width={currentLoadingSize}
|
|
54
|
+
primaryColor="#ffffff"
|
|
55
|
+
secondaryColor="#ffffff"
|
|
56
|
+
/>
|
|
57
|
+
) : (
|
|
58
|
+
<div className="flex flex-row justify-center items-center gap-x-2">
|
|
59
|
+
{icon ? <span>{icon}</span> : null}
|
|
60
|
+
<p>{title}</p>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</button>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default StartButton;
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as CreateButton } from "./components/buttons/CreateButton";
|
|
|
8
8
|
export { default as DeleteButton } from "./components/buttons/DeleteButton";
|
|
9
9
|
export { default as CancelButton } from "./components/buttons/CancelButton";
|
|
10
10
|
export { default as ApproveButton } from "./components/buttons/ApproveButton";
|
|
11
|
+
export { default as StartButton } from "./components/buttons/StartButton";
|
|
11
12
|
|
|
12
13
|
export { default as FullCard } from "./components/cards/FullCard";
|
|
13
14
|
export { default as BaseCard } from "./components/cards/BaseCard";
|