Skip to content

Commit

Permalink
Refactor #1876
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 13, 2021
1 parent 61d8dcc commit fed72ec
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ export class ButtonComponent extends Component {
tooltipOptions: null,
forwardRef: null,
loading: false,
loadingOptions: {
icon: 'pi pi-spin pi-spinner',
position: 'left'
}
loadingOptions: null
}

static propTypes = {
Expand Down Expand Up @@ -121,6 +118,7 @@ export class ButtonComponent extends Component {
}

render() {
let { icon: loadingIcon , position: loadingPosition } = this.props.loadingOptions;
let className = classNames('p-button p-component', this.props.className, {
'p-button-icon-only': this.props.icon && !this.props.label,
'p-button-vertical': (this.props.iconPos === 'top' || this.props.iconPos === 'bottom') && this.label,
Expand All @@ -129,7 +127,7 @@ export class ButtonComponent extends Component {
let icon = this.renderIcon(this.props.icon, this.props.iconPos);
let label = this.renderLabel();
let badge = this.renderBadge();
let loading = this.props.loading && this.renderIcon(this.props.loadingOptions.icon, this.props.loadingOptions.position);
let loading = this.props.loading && this.renderIcon(loadingIcon || 'pi pi-spin pi-spinner', loadingPosition);

let buttonProps = ObjectUtils.findDiffKeys(this.props, ButtonComponent.defaultProps);

Expand Down

0 comments on commit fed72ec

Please sign in to comment.