@cripty2001/utils 0.0.117 → 0.0.118
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { LucideIcon } from "lucide-react";
|
|
1
2
|
export type ButtonProps = {
|
|
2
3
|
title: string;
|
|
4
|
+
icon?: React.ReactElement<LucideIcon>;
|
|
3
5
|
onClick: () => void | Promise<void>;
|
|
4
6
|
className?: string;
|
|
5
7
|
};
|
|
6
|
-
export default function Button({ title, onClick, className }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function Button({ title, onClick, className, icon }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/react-ui/button.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.default = Button;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const lucide_react_1 = require("lucide-react");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
function Button({ title, onClick, className }) {
|
|
7
|
+
function Button({ title, onClick, className, icon }) {
|
|
8
8
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
9
9
|
const [error, setError] = (0, react_1.useState)(null);
|
|
10
10
|
const handleClick = async () => {
|
|
@@ -27,11 +27,13 @@ function Button({ title, onClick, className }) {
|
|
|
27
27
|
justifyContent: 'center',
|
|
28
28
|
textAlign: 'center',
|
|
29
29
|
cursor: 'pointer',
|
|
30
|
-
}, children: loading ?
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
}, children: loading ?
|
|
31
|
+
(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { style: {
|
|
32
|
+
width: '1rem',
|
|
33
|
+
height: '1rem',
|
|
34
|
+
animation: 'spin 1s linear infinite',
|
|
35
|
+
} }) :
|
|
36
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-row gap-4 items-center justify-center", children: [icon, title] }) }), error && (0, jsx_runtime_1.jsx)("div", { style: {
|
|
35
37
|
color: '#ef4444'
|
|
36
38
|
}, children: error })] }));
|
|
37
39
|
}
|
package/package.json
CHANGED