Skip to content

Commit

Permalink
chore: next-link codemod #312
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceRodrigues committed Aug 13, 2023
1 parent 07808ee commit 88b4f18
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/data-explorer-ui/src/components/Error/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const Error = ({
</SectionContent>
{rootPath && (
<SectionActions>
<Link href={rootPath} passHref>
<Link href={rootPath} passHref legacyBehavior>
<ButtonPrimary href="passHref">To Homepage</ButtonPrimary>
</Link>
</SectionActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ExportMethod = ({
<Typography variant="text-body-400-2lines">{description}</Typography>
</SectionContent>
<SectionActions>
<Link href={route} passHref>
<Link href={route} passHref legacyBehavior>
<ExportButton disabled={disabled}>{buttonLabel}</ExportButton>
</Link>
</SectionActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Hero = ({ Summaries, title }: HeroProps): JSX.Element => {
{/* TODO +n link widget, and accompanying Dot separator */}
{Summaries}
</SummaryWidget>
<Link href="/export" passHref>
<Link href="/export" passHref legacyBehavior>
<ExportButton href="passHref">Export</ExportButton>
</Link>
</Widgets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const Footer = ({
</Stack>
<Stack alignItems="stretch" direction="row" gap={6}>
{navLinks.map(({ label, url }) => (
<NLink key={label} href={url} passHref>
<NLink key={label} href={url} passHref legacyBehavior>
<Link
alignItems="center"
color="ink.main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const Logo = ({
}: LogoProps): JSX.Element => {
return (
<Link href={link} passHref>
<a href="passHref">
<StaticImage alt={alt} height={height} src={src} width={width} />
</a>
<StaticImage alt={alt} height={height} src={src} width={width} />
</Link>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const NavLinks = ({
menuItems ? (
<NavLinkMenu key={label} menuItems={menuItems} menuLabel={label} />
) : (
<Link key={url} href={url} passHref>
<Link key={url} href={url} passHref legacyBehavior>
<Button
href="passHref"
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Nav = ({ Hero, navigation }: NavProps): JSX.Element => {
{navigation.map(({ active, label, url }, i) => {
return (
<ListItem key={`${label}${i}`}>
<Link href={url ?? ""} passHref>
<Link href={url ?? ""} passHref legacyBehavior>
<ListItemButton disabled={!url} selected={active}>
<ListItemText disableTypography primary={label} />
</ListItemButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Link = ({
<>
{isClientSideNavigation(url) ? (
<>
<NLink href={url} passHref>
<NLink href={url} passHref legacyBehavior>
<MLink
rel="noopener"
noWrap={noWrap}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Contacts = ({ contacts }: ContactsProps): JSX.Element => {
<Typography variant="text-body-500-2lines">{name}</Typography>
{institution && <span>{institution}</span>}
{email && (
<Link href={`mailto:${email}`} passHref>
<Link href={`mailto:${email}`} passHref legacyBehavior>
<EmailLink>{email}</EmailLink>
</Link>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export const DataReleasePolicy = (): JSX.Element => {
<CollapsableSection title="Data Access Policy">
<Typography>
For information regarding data sharing and data use, please see our{" "}
<Link href="https://anvilproject.org/faq/data-security/" passHref>
<Link
href="https://anvilproject.org/faq/data-security/"
passHref
legacyBehavior
>
<PolicyLink target="_blank">Data Access Policy</PolicyLink>
</Link>
.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Breadcrumbs = ({
<MBreadcrumbs className={className} separator={Separator}>
{breadcrumbs.map(({ path, text }, b) =>
path ? (
<Link key={`${path}${b}`} href={path} passHref>
<Link key={`${path}${b}`} href={path} passHref legacyBehavior>
<BreadcrumbLink>{text}</BreadcrumbLink>
</Link>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const CallToActionButton = ({
const { label, target, url } = callToAction;
const isInternal = isClientSideNavigation(url);
return isInternal ? (
<NLink href={url} passHref>
<NLink href={url} passHref legacyBehavior>
<Button
className={className}
disabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const HelpIconButton = ({
}: HelpIconButtonProps): JSX.Element => {
const isInternal = isClientSideNavigation(url);
return isInternal ? (
<Link href={url} passHref>
<Link href={url} passHref legacyBehavior>
<Button
href="passHref"
rel="noopener"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Socials = ({
return (
<Box display="flex" sx={[...(Array.isArray(sx) ? sx : [sx])]}>
{socials.map(({ type, url }) => (
<Link key={type} href={url} passHref>
<Link key={type} href={url} passHref legacyBehavior>
<IconButtonElType
href="passHref"
rel="noopener"
Expand Down

0 comments on commit 88b4f18

Please sign in to comment.