fintech-component-library 2.0.3 → 2.0.5
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 +3 -2
- package/src/components/Button.tsx +50 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fintech-component-library",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"main": "./dist/fintech-component-library.umd.js",
|
|
5
5
|
"module": "./dist/fintech-component-library.es.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"./styles.css": "./dist/style.css"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"src/components"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
20
|
"dev": "vite",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
variant?: "primary" | "secondary" | "danger";
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Button: React.FC<ButtonProps> = ({
|
|
13
|
+
children,
|
|
14
|
+
onClick,
|
|
15
|
+
variant = "primary",
|
|
16
|
+
size = "md",
|
|
17
|
+
disabled = false,
|
|
18
|
+
className = "",
|
|
19
|
+
}) => {
|
|
20
|
+
const baseClasses =
|
|
21
|
+
"inline-flex items-center justify-center font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-200";
|
|
22
|
+
|
|
23
|
+
const variantClasses = {
|
|
24
|
+
primary: "bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500",
|
|
25
|
+
secondary: "bg-gray-600 hover:bg-gray-700 text-white focus:ring-gray-500",
|
|
26
|
+
danger: "bg-red-600 hover:bg-red-700 text-white focus:ring-red-500",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const sizeClasses = {
|
|
30
|
+
sm: "px-3 py-1.5 text-sm",
|
|
31
|
+
md: "px-4 py-2 text-base",
|
|
32
|
+
lg: "px-6 py-3 text-lg",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const disabledClasses = disabled ? "opacity-50 cursor-not-allowed" : "";
|
|
36
|
+
|
|
37
|
+
const classes = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${disabledClasses} ${className}`;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<button
|
|
41
|
+
className={classes}
|
|
42
|
+
onClick={disabled ? undefined : onClick}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</button>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default Button;
|