LAYOUT_VIEWPORT_MIN_WIDTH,
} from '../helpers/constants';
import { themeBorder, themeColor, themeContrast } from '../helpers/theme';
+import { BaseLink } from './Link';
const MainAppBarDiv = styled.div`
${tw`sw-sticky sw-top-0`}
}
`;
-const MainAppBarNavLogoLink = styled.a`
+const MainAppBarNavLogoLink = styled(BaseLink)`
border: none;
`;
return (
<MainAppBarDiv>
<MainAppBarNavLogoDiv>
- <MainAppBarNavLogoLink href="/">
+ <MainAppBarNavLogoLink to="/">
<Logo />
</MainAppBarNavLogoLink>
</MainAppBarNavLogoDiv>
/* eslint-disable import/no-extraneous-dependencies */
import { screen } from '@testing-library/react';
+import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { LAYOUT_LOGO_MAX_HEIGHT, LAYOUT_LOGO_MAX_WIDTH } from '../../helpers/constants';
import { render } from '../../helpers/testUtils';
import { FCProps } from '../../types/misc';
Logo: () => <img alt="logo" src="http://example.com/logo.png" />,
}
) {
- return render(<MainAppBar {...props} />);
+ return render(
+ <MemoryRouter initialEntries={['/']}>
+ <Routes>
+ <Route element={<MainAppBar {...props} />} path="/" />
+ </Routes>
+ </MemoryRouter>
+ );
}
import { getBranchLikeQuery } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path';
-import { getBranchLikeUrl, getComponentIssuesUrl, getPathUrlAsString } from '../../../helpers/urls';
+import { getBranchLikeUrl, getComponentIssuesUrl } from '../../../helpers/urls';
import { BranchLike } from '../../../types/branch-like';
import { ComponentQualifier } from '../../../types/component';
import { SourceViewerFile } from '../../../types/types';
{displayProjectName && (
<>
{linkToProject ? (
- <HoverLink
- to={getPathUrlAsString(getBranchLikeUrl(project, branchLike))}
- className="sw-mr-2"
- >
+ <HoverLink to={getBranchLikeUrl(project, branchLike)} className="sw-mr-2">
<LightLabel>{projectName}</LightLabel>
</HoverLink>
) : (
getCodeUrl,
getComponentIssuesUrl,
getComponentSecurityHotspotsUrl,
- getPathUrlAsString,
} from '../../helpers/urls';
import { ComponentQualifier } from '../../types/component';
>
<div className="sw-flex sw-flex-1 sw-flex-col sw-gap-1 sw-mr-5 sw-my-1">
<div className="sw-flex sw-gap-1 sw-items-center">
- <Link
- icon={<ProjectIcon />}
- to={getPathUrlAsString(getBranchLikeUrl(project, this.props.branchLike))}
- >
+ <Link icon={<ProjectIcon />} to={getBranchLikeUrl(project, this.props.branchLike)}>
{projectName}
</Link>
</div>