belong-ui-lib 1.0.6 → 1.0.8
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/components/Button/index.d.ts +10 -0
- package/dist/components/Button/index.js +16 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- 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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './button.css';
|
|
3
|
+
type ButtonType = 'default' | 'primary' | 'dashed' | 'text';
|
|
4
|
+
interface ButtonProps {
|
|
5
|
+
type?: ButtonType;
|
|
6
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Button: React.FC<ButtonProps>;
|
|
10
|
+
export default Button;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './button.css';
|
|
3
|
+
var Button = function (_a) {
|
|
4
|
+
var _b = _a.type, type = _b === void 0 ? 'default' : _b, onClick = _a.onClick, children = _a.children;
|
|
5
|
+
var className = [
|
|
6
|
+
'ant-btn',
|
|
7
|
+
"ant-btn-".concat(type),
|
|
8
|
+
]
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.join(' ');
|
|
11
|
+
var handleClick = function (e) {
|
|
12
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
13
|
+
};
|
|
14
|
+
return (_jsx("button", { className: className, onClick: handleClick, children: children }));
|
|
15
|
+
};
|
|
16
|
+
export default Button;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button } from "./Button";
|
|
1
|
+
export { default as Button } from "./components/Button";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button } from "./Button";
|
|
1
|
+
export { default as Button } from "./components/Button";
|
package/package.json
CHANGED
|
@@ -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;
|