diff --git a/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js b/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js index 94fade0e..709ae9bf 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js @@ -29,6 +29,10 @@ const styles = { align-items: center; border: 0 solid ${colors.textFieldBorder}; `, + publishedButton: css` + background-color: ${colorsRaw.tealLight}; + color: ${colorsRaw.teal}; + `, }; const ToolbarContainer = styled.div` @@ -140,9 +144,12 @@ const SaveButton = styled(ToolbarButton)` ${buttons.lightBlue}; `; -const PublishedButton = styled(StyledDropdownButton)` - background-color: ${colorsRaw.tealLight}; - color: ${colorsRaw.teal}; +const PublishedToolbarButton = styled(StyledDropdownButton)` + ${styles.publishedButton} +`; + +const PublishedButton = styled(ToolbarButton)` + ${styles.publishedButton} `; const PublishButton = styled(StyledDropdownButton)` @@ -289,23 +296,33 @@ class EditorToolbar extends React.Component { isNewEntry, t, } = this.props; + + const canCreate = collection.get('create'); if (!isNewEntry && !hasChanged) { return ( <> {this.renderDeployPreviewControls(t('editor.editorToolbar.deployButtonLabel'))} - ( - {t('editor.editorToolbar.published')} - )} - > - - + {canCreate ? ( + ( + + {t('editor.editorToolbar.published')} + + )} + > + { + + } + + ) : ( + {t('editor.editorToolbar.published')} + )} ); } @@ -328,7 +345,7 @@ class EditorToolbar extends React.Component { iconDirection="right" onClick={onPersist} /> - {collection.get('create') ? ( + {canCreate ? ( <> @@ -458,7 +477,7 @@ class EditorToolbar extends React.Component { iconDirection="right" onClick={onPublish} /> - {collection.get('create') ? ( + {canCreate ? ( <> ( - + {isPersisting ? t('editor.editorToolbar.unpublishing') : t('editor.editorToolbar.published')} - + )} > - + {canCreate && ( + + )} );