Skip to content

Commit

Permalink
Button - refactor for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Nov 8, 2018
1 parent 4729357 commit f13294a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/editor/src/components/post-publish-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ export class PostPublishButton extends Component {
forceIsDirty,
forceIsSaving,
} = this.props;
const isButtonEnabled = ( ! isSaving && ! forceIsSaving ) &&
( forceIsDirty || isPublishable ) &&
( isSaveable && ! isPostSavingLocked );
const isButtonDisabled =
isSaving ||
forceIsSaving ||
! isSaveable ||
isPostSavingLocked ||
( ! isPublishable && ! forceIsDirty );

let publishStatus;
if ( ! hasPublishAction ) {
Expand All @@ -70,7 +73,7 @@ export class PostPublishButton extends Component {
isPrimary
isLarge
onClick={ onClick }
disabled={ ! isButtonEnabled }
disabled={ isButtonDisabled }
isBusy={ isSaving && isPublished }
>
<PublishButtonLabel forceIsSaving={ forceIsSaving } />
Expand Down

0 comments on commit f13294a

Please sign in to comment.