* feat(ui): rework for player look * remove unused code * move summary button and block inside xray * move class * fixup mobile controls panel * change notes, change xray feat selection
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import cn from 'classnames';
|
|
import stl from './controlButton.module.css';
|
|
import { Popover, Button } from 'antd';
|
|
|
|
interface IProps {
|
|
label: string;
|
|
icon?: string;
|
|
disabled?: boolean;
|
|
onClick?: () => void;
|
|
count?: number;
|
|
hasErrors?: boolean;
|
|
active?: boolean;
|
|
size?: number;
|
|
noLabel?: boolean;
|
|
labelClassName?: string;
|
|
containerClassName?: string;
|
|
noIcon?: boolean;
|
|
popover?: React.ReactNode;
|
|
}
|
|
|
|
const ControlButton = ({
|
|
label,
|
|
disabled = false,
|
|
onClick,
|
|
hasErrors = false,
|
|
active = false,
|
|
popover = undefined,
|
|
}: IProps) => (
|
|
<Popover content={popover} open={popover ? undefined : false}>
|
|
<Button
|
|
size={'small'}
|
|
onClick={onClick}
|
|
id={'control-button-' + label.toLowerCase()}
|
|
disabled={disabled}
|
|
>
|
|
<div className={stl.labels}>{hasErrors && <div className={stl.errorSymbol} />}</div>
|
|
<span className={cn('font-semibold hover:text-main', active ? 'color-main' : 'color-gray-darkest')}>
|
|
{label}
|
|
</span>
|
|
</Button>
|
|
</Popover>
|
|
);
|
|
|
|
ControlButton.displayName = 'ControlButton';
|
|
|
|
export default ControlButton;
|