belong-ui-lib 1.0.5 → 1.0.7
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 +1 -3
- package/src/components/Button/index.css +39 -0
- package/src/components/Button/index.tsx +35 -0
- package/src/index.tsx +1 -1
- package/src/Button.tsx +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "belong-ui-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "belong-ui-lib",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"build": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"react": "^18.2.0",
|
|
13
|
-
"react-dom": "^18.2.0",
|
|
14
12
|
"@types/react": "^18.0.0",
|
|
15
13
|
"@types/react-dom": "^18.0.0",
|
|
16
14
|
"typescript": "^5.9.3"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.ant-btn {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
border-radius: 6px;
|
|
6
|
+
border: 1px solid #d9d9d9;
|
|
7
|
+
background: #fff;
|
|
8
|
+
color: rgba(0, 0, 0, 0.88);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
transition: all 0.2s;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
gap: 6px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ant-btn:hover {
|
|
16
|
+
border-color: #4096ff;
|
|
17
|
+
color: #4096ff;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* 类型 */
|
|
21
|
+
.ant-btn-primary {
|
|
22
|
+
background: #1677ff;
|
|
23
|
+
border-color: #1677ff;
|
|
24
|
+
color: #fff;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ant-btn-primary:hover {
|
|
28
|
+
background: #4096ff;
|
|
29
|
+
border-color: #4096ff;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-btn-dashed {
|
|
33
|
+
border-style: dashed;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ant-btn-text {
|
|
37
|
+
border-color: transparent;
|
|
38
|
+
background: transparent;
|
|
39
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './button.css'
|
|
3
|
+
|
|
4
|
+
type ButtonType = 'default' | 'primary' | 'dashed' | 'text'
|
|
5
|
+
|
|
6
|
+
interface ButtonProps {
|
|
7
|
+
type?: ButtonType
|
|
8
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>
|
|
9
|
+
children?: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Button: React.FC<ButtonProps> = ({
|
|
13
|
+
type = 'default',
|
|
14
|
+
onClick,
|
|
15
|
+
children,
|
|
16
|
+
}) => {
|
|
17
|
+
const className = [
|
|
18
|
+
'ant-btn',
|
|
19
|
+
`ant-btn-${type}`,
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join(' ')
|
|
23
|
+
|
|
24
|
+
const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
|
25
|
+
onClick?.(e)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<button className={className} onClick={handleClick}>
|
|
30
|
+
{children}
|
|
31
|
+
</button>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default Button
|
package/src/index.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button } from "./Button";
|
|
1
|
+
export { default as Button } from "./components/Button";
|
package/src/Button.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export interface ButtonProps {
|
|
4
|
-
text: string;
|
|
5
|
-
onClick?: () => void;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Button: React.FC<ButtonProps> = ({ text, onClick }) => {
|
|
9
|
-
console.log(11111);
|
|
10
|
-
return (
|
|
11
|
-
<button
|
|
12
|
-
style={{ padding: "8px 16px", cursor: "pointer" }}
|
|
13
|
-
onClick={onClick}
|
|
14
|
-
>
|
|
15
|
-
{text}
|
|
16
|
-
</button>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default Button;
|