mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Removing top cancel button when in send draft flow (#12304)
This commit is contained in:
parent
e328433b70
commit
31b681f301
@ -104,6 +104,10 @@
|
||||
color: $black;
|
||||
font-weight: 500;
|
||||
margin-right: 1.5rem;
|
||||
|
||||
&--no-margin-right {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__subtitle {
|
||||
|
@ -15,6 +15,7 @@ export default class PageContainerHeader extends Component {
|
||||
tabs: PropTypes.node,
|
||||
headerCloseText: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
hideClose: PropTypes.bool,
|
||||
};
|
||||
|
||||
renderTabs() {
|
||||
@ -23,6 +24,37 @@ export default class PageContainerHeader extends Component {
|
||||
return tabs && <ul className="page-container__tabs">{tabs}</ul>;
|
||||
}
|
||||
|
||||
renderCloseAction() {
|
||||
const { hideClose, onClose, headerCloseText } = this.props;
|
||||
|
||||
if (hideClose) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (headerCloseText) {
|
||||
return (
|
||||
onClose && (
|
||||
<Button
|
||||
type="link"
|
||||
className="page-container__header-close-text"
|
||||
onClick={() => onClose()}
|
||||
>
|
||||
{headerCloseText}
|
||||
</Button>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
onClose && (
|
||||
<div
|
||||
className="page-container__header-close"
|
||||
onClick={() => onClose()}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderHeaderRow() {
|
||||
const {
|
||||
showBackButton,
|
||||
@ -47,14 +79,7 @@ export default class PageContainerHeader extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
title,
|
||||
subtitle,
|
||||
onClose,
|
||||
tabs,
|
||||
headerCloseText,
|
||||
className,
|
||||
} = this.props;
|
||||
const { title, subtitle, tabs, className, hideClose } = this.props;
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -65,26 +90,18 @@ export default class PageContainerHeader extends Component {
|
||||
>
|
||||
{this.renderHeaderRow()}
|
||||
|
||||
{title && <div className="page-container__title">{title}</div>}
|
||||
|
||||
{title && (
|
||||
<div
|
||||
className={classnames('page-container__title', {
|
||||
'page-container__title--no-margin-right': hideClose,
|
||||
})}
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
)}
|
||||
{subtitle && <div className="page-container__subtitle">{subtitle}</div>}
|
||||
|
||||
{onClose && headerCloseText ? (
|
||||
<Button
|
||||
type="link"
|
||||
className="page-container__header-close-text"
|
||||
onClick={() => onClose()}
|
||||
>
|
||||
{headerCloseText}
|
||||
</Button>
|
||||
) : (
|
||||
onClose && (
|
||||
<div
|
||||
className="page-container__header-close"
|
||||
onClick={() => onClose()}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
{this.renderCloseAction()}
|
||||
|
||||
{this.renderTabs()}
|
||||
</div>
|
||||
|
@ -41,6 +41,7 @@ export default function SendHeader() {
|
||||
headerCloseText={
|
||||
stage === SEND_STAGES.EDIT ? t('cancelEdit') : t('cancel')
|
||||
}
|
||||
hideClose={stage === SEND_STAGES.DRAFT}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user