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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.6.11",
3
+ "version": "2.6.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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";
@@ -6,4 +6,5 @@ export interface IButtonProps {
6
6
  iconPosition?: string;
7
7
  textOnly?: boolean;
8
8
  iconOnly?: boolean;
9
+ icon?: string;
9
10
  }