- {iconPosition === 'left' && renderIcon('left')}
+ {currentIconPosition === 'left' && renderIcon('left')}
{renderText()}
- {iconPosition === 'right' && renderIcon('right')}
+ {currentIconPosition === 'right' && renderIcon('right')}
);
};
diff --git a/src/components/button/demos/demo-group.tsx b/src/components/button/demos/demo-group.tsx
new file mode 100644
index 0000000..e6ed79e
--- /dev/null
+++ b/src/components/button/demos/demo-group.tsx
@@ -0,0 +1,29 @@
+import React from 'react';
+import { Button, Space, AuntIconArrowLeft, AuntIconArrowRight, AuntIconRefreshCcw } from 'aunt';
+
+export default () => (
+
-
-
-
+ <>
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
+
+
+
+
-
+ >
);
}
diff --git a/src/components/button/index.ts b/src/components/button/index.ts
index 11e73dc..59f9dce 100644
--- a/src/components/button/index.ts
+++ b/src/components/button/index.ts
@@ -1,7 +1,12 @@
import './styles/index.less';
-import { Button } from './button';
+import { Button as _Button } from './button';
+import ButtonGroup from './button-group';
export type { ButtonProps, ButtonType, ButtonSize, ButtonShape } from './types';
+const Button = Object.assign(_Button, {
+ Group: ButtonGroup,
+});
+
export { Button };
export default Button;
diff --git a/src/components/button/styles/index.less b/src/components/button/styles/index.less
index 657357a..5d580a7 100644
--- a/src/components/button/styles/index.less
+++ b/src/components/button/styles/index.less
@@ -203,4 +203,77 @@
display: none;
}
}
+
+ &__group{
+ display: inline-flex;
+ overflow: hidden;
+ border-width: var(--aunt-button-border-width);
+ border-style: solid;
+
+ .@{class-prefix}-button{
+ border-radius: 0;
+ border-width: 0;
+ border-right-width: var(--aunt-button-border-width);
+ flex: 1;
+ &__text{
+ white-space: nowrap;
+ }
+ &:last-child {
+ border-width: 0;
+ }
+ }
+
+ &--default{
+ border-color: var(--aunt-button-border-default-color);
+ .@{class-prefix}-button{
+ border-color: var(--aunt-button-border-default-color);
+ }
+ }
+
+ &--primary{
+ border-color: var(--aunt-button-border-primary-color);
+ .@{class-prefix}-button{
+ border-color: var(--aunt-button-border-primary-color);
+ }
+ }
+ &--success{
+ border-color: var(--aunt-button-border-success-color);
+ .@{class-prefix}-button{
+ border-color: var(--aunt-button-border-success-color);
+ }
+ }
+ &--warning{
+ border-color: var(--aunt-button-border-warning-color);
+ .@{class-prefix}-button{
+ border-color: var(--aunt-button-border-warning-color);
+ }
+ }
+ &--danger{
+ border-color: var(--aunt-button-border-danger-color);
+ .@{class-prefix}-button{
+ border-color: var(--aunt-button-border-danger-color);
+ }
+ }
+
+ &__shape{
+ &--default{
+ border-radius: var(--aunt-button-border-radius);
+ }
+ &--square{
+ border-radius: 0;
+ }
+ &--round{
+ border-radius: var(--aunt-border-radius-max);
+ }
+ }
+
+ &--disabled {
+ cursor: not-allowed;
+ opacity: var(--aunt-button-disabled-opacity);
+
+ .@{class-prefix}-button{
+ --aunt-button-disabled-opacity: 1;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/components/button/types.ts b/src/components/button/types.ts
index 843ac9a..e21ec52 100644
--- a/src/components/button/types.ts
+++ b/src/components/button/types.ts
@@ -83,7 +83,7 @@ export interface ButtonProps extends BaseTypeProps {
* @name 按钮图标位置
* @default 'left'
*/
- iconPosition: IconPosition;
+ iconPosition?: IconPosition;
/**
* @name 按钮文字
* @default ''
@@ -96,5 +96,11 @@ export interface ButtonProps extends BaseTypeProps {
* @param event React.MouseEvent