This commit is contained in:
2026-08-08 19:05:08 +03:30
commit 30bd9fc01c
102 changed files with 14450 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
import {Component} from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import {withoutWeightColor} from './utils';
class FilledButton extends Component {
getColorClass = () => {
const {color, colorWeight, textColor, textColorWeight, disabled} = this.props;
return classNames(
{[textColorWeight ? `text-${textColor}-${textColorWeight}` : `text-${textColor}`]: textColor},
{'text-white': !textColor},
{'opacity-40 cursor-not-allowed': disabled},
withoutWeightColor.includes(color) ? `bg-${color}` : `bg-${color}-${colorWeight}`,
{[`hover:bg-${color}-${colorWeight + 100}`]: !withoutWeightColor.includes(color) && !disabled}
);
};
render() {
return (
<button
type={this.props.type}
disabled={this.props.disabled}
onClick={this.props.onClick}
className={classNames(
'focus:outline-none rounded-md',
this.getColorClass(),
{'hover:shadow-lg hover:font-semibold': !this.props.disabled},
this.props.className
)}
>
{this.props.children}
</button>
);
}
}
FilledButton.defaultProps = {
type: 'button',
color: 'blue',
colorWeight: 500,
borderWeight: 1,
loading: false,
disabled: false
};
FilledButton.propTypes = {
color: PropTypes.string.isRequired,
colorWeight: PropTypes.number.isRequired,
borderWeight: PropTypes.number.isRequired,
textColor: PropTypes.string,
textColorWeight: PropTypes.string,
type: PropTypes.string.isRequired,
onClick: PropTypes.func,
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node)
]),
loading: PropTypes.bool.isRequired,
disabled: PropTypes.bool.isRequired,
className: PropTypes.string
};
export default FilledButton;