|
@@ -4,25 +4,19 @@
|
|
|
|
|
|
import { ButtonProps } from './types';
|
|
|
|
|
|
-import React, { useState } from 'react';
|
|
|
+import React from 'react';
|
|
|
import SUIButton from 'semantic-ui-react/dist/commonjs/elements/Button/Button';
|
|
|
import styled from 'styled-components';
|
|
|
|
|
|
import Icon from '../Icon';
|
|
|
-import Tooltip from '../Tooltip';
|
|
|
|
|
|
-let idCounter = 0;
|
|
|
-
|
|
|
-function Button ({ children, className = '', floated, icon, isAnimated, isBasic = false, isCircular = false, isDisabled = false, isFluid = false, isIcon, isLoading = false, isNegative = false, isPositive = false, isPrimary = false, label, labelPosition, onClick, onMouseEnter, onMouseLeave, size, tabIndex, tooltip }: ButtonProps): React.ReactElement<ButtonProps> {
|
|
|
- const [triggerId] = useState(`button-${++idCounter}`);
|
|
|
+function Button ({ children, className = '', floated, icon, isAnimated, isBasic = false, isCircular = false, isDisabled = false, isFluid = false, isIcon, isLoading = false, isNegative = false, isPositive = false, isPrimary = false, label, labelPosition, onClick, onMouseEnter, onMouseLeave, size, tabIndex }: ButtonProps): React.ReactElement<ButtonProps> {
|
|
|
const props = {
|
|
|
animate: 'fade',
|
|
|
animated: isAnimated,
|
|
|
basic: isBasic,
|
|
|
- circular: isCircular,
|
|
|
+ circular: true,
|
|
|
className: `${className} ${isCircular ? 'isCircular' : ''} ${isIcon ? 'isIcon' : ''} ${(isCircular || isIcon || !(children || label)) ? 'icon' : ''}`,
|
|
|
- 'data-for': triggerId,
|
|
|
- 'data-tip': !!tooltip,
|
|
|
disabled: isDisabled,
|
|
|
floated,
|
|
|
fluid: isFluid,
|
|
@@ -48,18 +42,13 @@ function Button ({ children, className = '', floated, icon, isAnimated, isBasic
|
|
|
{label}
|
|
|
{children}
|
|
|
</SUIButton>
|
|
|
- {tooltip && (
|
|
|
- <Tooltip
|
|
|
- place='top'
|
|
|
- text={tooltip}
|
|
|
- trigger={triggerId}
|
|
|
- />
|
|
|
- )}
|
|
|
</>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
export default React.memo(styled(Button)`
|
|
|
+ border-radius: 10rem !important;
|
|
|
+
|
|
|
&:not(.icon) {
|
|
|
> .ui--Icon {
|
|
|
margin-right: 0.25rem;
|