import PropTypes from 'prop-types'; import { Icon, IconButton, Spinner } from '@openedx/paragon'; import { ArrowBack } from '@openedx/paragon/icons'; import { useNavigate } from 'react-router-dom'; import { useIntl } from '@edx/frontend-platform/i18n'; import messages from '../messages'; const BackButton = ({ path, title, loading, }) => { const intl = useIntl(); const navigate = useNavigate(); return ( <>
navigate(path)} alt={intl.formatMessage(messages.backAlt)} />
{loading ? : title}
); }; BackButton.propTypes = { path: PropTypes.shape({}).isRequired, title: PropTypes.string.isRequired, loading: PropTypes.bool, }; BackButton.defaultProps = { loading: false, }; export default BackButton;