chore: Refactoring all import directories to alias and all .js|.jsx renamed to be .ts|.tsx

This commit is contained in:
a.bouhuolia
2022-07-15 23:25:23 +02:00
parent cd08d0ee16
commit f00097f6c8
3846 changed files with 125197 additions and 128236 deletions

View File

@@ -0,0 +1,39 @@
import React from 'react';
import withBreadcrumbs from 'react-router-breadcrumbs-hoc';
import { useHistory } from 'react-router-dom';
import { getDashboardRoutes } from '@/routes/dashboard';
import { If, Icon } from '@/components';
import { FormattedMessage as T } from '@/components';
import withDashboard from '@/containers/Dashboard/withDashboard';
import { compose } from '@/utils';
function DashboardBackLink({ dashboardBackLink, breadcrumbs }) {
const history = useHistory();
const crumb = breadcrumbs[breadcrumbs.length - 2];
const handleClick = (event) => {
const url =
typeof dashboardBackLink === 'string'
? dashboardBackLink
: crumb.match.url;
history.push(url);
event.preventDefault();
};
return (
<If condition={dashboardBackLink && crumb}>
<div class="dashboard__back-link">
<a href="#no-link" onClick={handleClick}>
<Icon icon={'arrow-left'} iconSize={18} /> <T id={'back_to_list'} />
</a>
</div>
</If>
);
}
export default compose(
withBreadcrumbs([]),
withDashboard(({ dashboardBackLink }) => ({
dashboardBackLink,
})),
)(DashboardBackLink);