2022-06-30 07:51:36 -07:00
|
|
|
// import throttle from 'lodash/throttle';
|
|
|
|
import React from 'react';
|
|
|
|
import { defineMessages, useIntl } from 'react-intl';
|
|
|
|
// import { connect } from 'react-redux';
|
|
|
|
import { useHistory } from 'react-router-dom';
|
|
|
|
|
|
|
|
import { CardHeader, CardTitle } from './ui';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
back: { id: 'column_back_button.label', defaultMessage: 'Back' },
|
|
|
|
});
|
|
|
|
|
|
|
|
interface ISubNavigation {
|
2022-11-03 17:56:03 -07:00
|
|
|
message: React.ReactNode,
|
|
|
|
/** @deprecated Unused. */
|
2022-06-30 07:51:36 -07:00
|
|
|
settings?: React.ComponentType,
|
|
|
|
}
|
|
|
|
|
|
|
|
const SubNavigation: React.FC<ISubNavigation> = ({ message }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
const history = useHistory();
|
|
|
|
|
|
|
|
const handleBackClick = () => {
|
|
|
|
if (window.history && window.history.length === 1) {
|
|
|
|
history.push('/');
|
|
|
|
} else {
|
|
|
|
history.goBack();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<CardHeader
|
|
|
|
aria-label={intl.formatMessage(messages.back)}
|
|
|
|
onBackClick={handleBackClick}
|
|
|
|
>
|
|
|
|
<CardTitle title={message} />
|
|
|
|
</CardHeader>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SubNavigation;
|