use button group as publish file header instead of title for better app parity

This commit is contained in:
Sean Yesmunt 2020-08-05 13:06:24 -04:00
parent 3da4df6b8f
commit c4e6605ada
2 changed files with 21 additions and 28 deletions

View file

@ -36,6 +36,7 @@ type Props = {
setPublishMode: string => void,
setPrevFileText: string => void,
setAutoPopulateName: boolean => void,
header: any,
};
function PublishFile(props: Props) {
@ -62,6 +63,7 @@ function PublishFile(props: Props) {
setPrevFileText,
autoPopulateName,
setAutoPopulateName,
header,
} = props;
const ffmpegAvail = ffmpegStatus.available;
@ -324,28 +326,17 @@ function PublishFile(props: Props) {
updatePublishForm(publishFormParams);
}
let cardTitle;
if (publishing) {
cardTitle = (
<span>
{__('Uploading')}
<Spinner type={'small'} />
</span>
);
} else {
cardTitle = isStillEditing ? __('Edit') : __('Upload');
}
const isPublishFile = mode === PUBLISH_MODES.FILE;
const isPublishPost = mode === PUBLISH_MODES.POST;
return (
<Card
icon={ICONS.PUBLISH}
// icon={ICONS.PUBLISH}
disabled={disabled || balance === 0}
title={
<React.Fragment>
{cardTitle}{' '}
{header}
{publishing && <Spinner type={'small'} />}
{inProgress && <Button button="close" label={__('Cancel')} icon={ICONS.REMOVE} onClick={clearPublish} />}
</React.Fragment>
}

View file

@ -291,7 +291,18 @@ function PublishForm(props: Props) {
// Editing claim uri
return (
<div className="card-stack">
<div className="button-tab-group">
<PublishFile
uri={uri}
mode={mode}
fileMimeType={fileMimeType}
disabled={disabled || publishing}
inProgress={isInProgress}
setPublishMode={setMode}
setPrevFileText={setPrevFileText}
autoPopulateName={autoPopulateNameFromTitle}
setAutoPopulateName={setAutoPopulateNameFromTitle}
header={
<div>
{MODES.map((modeName, index) => (
<Button
key={index}
@ -305,16 +316,7 @@ function PublishForm(props: Props) {
/>
))}
</div>
<PublishFile
uri={uri}
mode={mode}
fileMimeType={fileMimeType}
disabled={disabled || publishing}
inProgress={isInProgress}
setPublishMode={setMode}
setPrevFileText={setPrevFileText}
autoPopulateName={autoPopulateNameFromTitle}
setAutoPopulateName={setAutoPopulateNameFromTitle}
}
/>
{!publishing && (
<div className={classnames({ 'card--disabled': formDisabled })}>