Skip to content

Commit

Permalink
[desk-tool] Publish badge in document list (#1407)
Browse files Browse the repository at this point in the history
* [desk-tool] Draft badge instead of pencil

* [desk-tool] Disabled publish button when stuff is going on

* [desk-tool] Draft status tooltip text
  • Loading branch information
Kristoffer J. Sivertsen authored Aug 2, 2019
1 parent 9e613da commit 0de35e2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
12 changes: 7 additions & 5 deletions packages/@sanity/desk-tool/src/components/DraftStatus.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import React from 'react'
import EditIcon from 'part:@sanity/base/edit-icon'
import {Tooltip} from 'react-tippy'
import styles from './styles/ItemStatus.css'
import Badge from 'part:@sanity/components/badges/default'

const DraftStatus = () => (
<Tooltip
className={styles.itemStatus}
title="Has changes not yet published"
title="There are unpublished edits"
arrow
theme="light"
distance="2"
sticky
size="small"
>
<i>
<EditIcon />
</i>
<div className={styles.draftBadge}>
<Badge inverted faded>
Draft
</Badge>
</div>
</Tooltip>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
align-items: center;
}
}

.draftBadge {
font-size: var(--font-size-tiny--relative);
opacity: 0.75;
}
10 changes: 9 additions & 1 deletion packages/@sanity/desk-tool/src/pane/Editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,15 @@ export default withRouterHOC(
html={this.renderPublishButtonTooltip(errors, published)}
>
<Button
disabled={isReconnecting || !draft || errors.length > 0}
disabled={
isCreatingDraft ||
isPublishing ||
isReconnecting ||
isRestoring ||
isUnpublishing ||
!draft ||
errors.length > 0
}
onClick={this.handlePublishRequested}
color="primary"
>
Expand Down

0 comments on commit 0de35e2

Please sign in to comment.