|
|
@ -1,5 +1,6 @@
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { createPortal } from 'react-dom';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
|
|
|
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
|
|
|
import Icon from 'mastodon/components/icon';
|
|
|
|
import Icon from 'mastodon/components/icon';
|
|
|
@ -28,6 +29,7 @@ class ColumnHeader extends React.PureComponent {
|
|
|
|
showBackButton: PropTypes.bool,
|
|
|
|
showBackButton: PropTypes.bool,
|
|
|
|
children: PropTypes.node,
|
|
|
|
children: PropTypes.node,
|
|
|
|
pinned: PropTypes.bool,
|
|
|
|
pinned: PropTypes.bool,
|
|
|
|
|
|
|
|
placeholder: PropTypes.bool,
|
|
|
|
onPin: PropTypes.func,
|
|
|
|
onPin: PropTypes.func,
|
|
|
|
onMove: PropTypes.func,
|
|
|
|
onMove: PropTypes.func,
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
onClick: PropTypes.func,
|
|
|
@ -79,7 +81,7 @@ class ColumnHeader extends React.PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
render () {
|
|
|
|
const { title, icon, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage } } = this.props;
|
|
|
|
const { title, icon, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, placeholder } = this.props;
|
|
|
|
const { collapsed, animating } = this.state;
|
|
|
|
const { collapsed, animating } = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
const wrapperClassName = classNames('column-header__wrapper', {
|
|
|
|
const wrapperClassName = classNames('column-header__wrapper', {
|
|
|
@ -146,7 +148,7 @@ class ColumnHeader extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
const hasTitle = icon && title;
|
|
|
|
const hasTitle = icon && title;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
const component = (
|
|
|
|
<div className={wrapperClassName}>
|
|
|
|
<div className={wrapperClassName}>
|
|
|
|
<h1 className={buttonClassName}>
|
|
|
|
<h1 className={buttonClassName}>
|
|
|
|
{hasTitle && (
|
|
|
|
{hasTitle && (
|
|
|
@ -172,6 +174,12 @@ class ColumnHeader extends React.PureComponent {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (multiColumn || placeholder) {
|
|
|
|
|
|
|
|
return component;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return createPortal(component, document.getElementById('tabs-bar__portal'));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|