feat: remove space between buttons (#5729)
This commit is contained in:
parent
f0cafb592c
commit
737573a98b
@ -301,14 +301,21 @@ export class EditorToolbar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSimpleSaveControls = () => {
|
renderSimpleControls = () => {
|
||||||
const { showDelete, onDelete, t } = this.props;
|
const { collection, hasChanged, isNewEntry, showDelete, onDelete, t } = this.props;
|
||||||
|
const canCreate = collection.get('create');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
{!isNewEntry && !hasChanged
|
||||||
|
? this.renderExistingEntrySimplePublishControls({ canCreate })
|
||||||
|
: this.renderNewEntrySimplePublishControls({ canCreate })}
|
||||||
<div>
|
<div>
|
||||||
{showDelete ? (
|
{showDelete ? (
|
||||||
<DeleteButton onClick={onDelete}>{t('editor.editorToolbar.deleteEntry')}</DeleteButton>
|
<DeleteButton onClick={onDelete}>{t('editor.editorToolbar.deleteEntry')}</DeleteButton>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -545,22 +552,15 @@ export class EditorToolbar extends React.Component {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderSimplePublishControls = () => {
|
renderSimpleDeployPreviewControls = () => {
|
||||||
const { collection, hasChanged, isNewEntry, t } = this.props;
|
const { hasChanged, isNewEntry, t } = this.props;
|
||||||
|
|
||||||
const canCreate = collection.get('create');
|
|
||||||
if (!isNewEntry && !hasChanged) {
|
if (!isNewEntry && !hasChanged) {
|
||||||
return (
|
return this.renderDeployPreviewControls(t('editor.editorToolbar.deployButtonLabel'));
|
||||||
<>
|
|
||||||
{this.renderDeployPreviewControls(t('editor.editorToolbar.deployButtonLabel'))}
|
|
||||||
{this.renderExistingEntrySimplePublishControls({ canCreate })}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return this.renderNewEntrySimplePublishControls({ canCreate });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
renderWorkflowSaveControls = () => {
|
renderWorkflowControls = () => {
|
||||||
const {
|
const {
|
||||||
onPersist,
|
onPersist,
|
||||||
onDelete,
|
onDelete,
|
||||||
@ -573,9 +573,15 @@ export class EditorToolbar extends React.Component {
|
|||||||
isDeleting,
|
isDeleting,
|
||||||
isNewEntry,
|
isNewEntry,
|
||||||
isModification,
|
isModification,
|
||||||
|
currentStatus,
|
||||||
|
collection,
|
||||||
t,
|
t,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const canCreate = collection.get('create');
|
||||||
|
const canPublish = collection.get('publish') && !useOpenAuthoring;
|
||||||
|
const canDelete = collection.get('delete', true);
|
||||||
|
|
||||||
const deleteLabel =
|
const deleteLabel =
|
||||||
(hasUnpublishedChanges &&
|
(hasUnpublishedChanges &&
|
||||||
isModification &&
|
isModification &&
|
||||||
@ -593,6 +599,13 @@ export class EditorToolbar extends React.Component {
|
|||||||
>
|
>
|
||||||
{isPersisting ? t('editor.editorToolbar.saving') : t('editor.editorToolbar.save')}
|
{isPersisting ? t('editor.editorToolbar.saving') : t('editor.editorToolbar.save')}
|
||||||
</SaveButton>,
|
</SaveButton>,
|
||||||
|
currentStatus
|
||||||
|
? [
|
||||||
|
this.renderWorkflowStatusControls(),
|
||||||
|
this.renderNewEntryWorkflowPublishControls({ canCreate, canPublish }),
|
||||||
|
]
|
||||||
|
: !isNewEntry &&
|
||||||
|
this.renderExistingEntryWorkflowPublishControls({ canCreate, canPublish, canDelete }),
|
||||||
(!showDelete || useOpenAuthoring) && !hasUnpublishedChanges && !isModification ? null : (
|
(!showDelete || useOpenAuthoring) && !hasUnpublishedChanges && !isModification ? null : (
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
key="delete-button"
|
key="delete-button"
|
||||||
@ -604,33 +617,18 @@ export class EditorToolbar extends React.Component {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
renderWorkflowPublishControls = () => {
|
renderWorkflowDeployPreviewControls = () => {
|
||||||
const { collection, currentStatus, isNewEntry, useOpenAuthoring, t } = this.props;
|
const { currentStatus, isNewEntry, t } = this.props;
|
||||||
|
|
||||||
const canCreate = collection.get('create');
|
|
||||||
const canPublish = collection.get('publish') && !useOpenAuthoring;
|
|
||||||
const canDelete = collection.get('delete', true);
|
|
||||||
|
|
||||||
if (currentStatus) {
|
if (currentStatus) {
|
||||||
return (
|
return this.renderDeployPreviewControls(t('editor.editorToolbar.deployPreviewButtonLabel'));
|
||||||
<>
|
|
||||||
{this.renderDeployPreviewControls(t('editor.editorToolbar.deployPreviewButtonLabel'))}
|
|
||||||
{this.renderWorkflowStatusControls()}
|
|
||||||
{this.renderNewEntryWorkflowPublishControls({ canCreate, canPublish })}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish control for published workflow entry.
|
* Publish control for published workflow entry.
|
||||||
*/
|
*/
|
||||||
if (!isNewEntry) {
|
if (!isNewEntry) {
|
||||||
return (
|
return this.renderDeployPreviewControls(t('editor.editorToolbar.deployButtonLabel'));
|
||||||
<>
|
|
||||||
{this.renderDeployPreviewControls(t('editor.editorToolbar.deployButtonLabel'))}
|
|
||||||
{this.renderExistingEntryWorkflowPublishControls({ canCreate, canPublish, canDelete })}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -665,12 +663,12 @@ export class EditorToolbar extends React.Component {
|
|||||||
</ToolbarSectionBackLink>
|
</ToolbarSectionBackLink>
|
||||||
<ToolbarSectionMain>
|
<ToolbarSectionMain>
|
||||||
<ToolbarSubSectionFirst>
|
<ToolbarSubSectionFirst>
|
||||||
{hasWorkflow ? this.renderWorkflowSaveControls() : this.renderSimpleSaveControls()}
|
{hasWorkflow ? this.renderWorkflowControls() : this.renderSimpleControls()}
|
||||||
</ToolbarSubSectionFirst>
|
</ToolbarSubSectionFirst>
|
||||||
<ToolbarSubSectionLast>
|
<ToolbarSubSectionLast>
|
||||||
{hasWorkflow
|
{hasWorkflow
|
||||||
? this.renderWorkflowPublishControls()
|
? this.renderWorkflowDeployPreviewControls()
|
||||||
: this.renderSimplePublishControls()}
|
: this.renderSimpleDeployPreviewControls()}
|
||||||
</ToolbarSubSectionLast>
|
</ToolbarSubSectionLast>
|
||||||
</ToolbarSectionMain>
|
</ToolbarSectionMain>
|
||||||
<ToolbarSectionMeta>
|
<ToolbarSectionMeta>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@ const styles = {
|
|||||||
background-color: ${colors.background};
|
background-color: ${colors.background};
|
||||||
color: ${colors.textLight};
|
color: ${colors.textLight};
|
||||||
border-radius: ${lengths.borderRadius};
|
border-radius: ${lengths.borderRadius};
|
||||||
margin: 10px;
|
margin: 50px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
`,
|
`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user