Skip to content

Commit e9b7008

Browse files
refactor: use link helper over Gatsby's Link (freeCodeCamp#55767)
1 parent 18fe868 commit e9b7008

File tree

6 files changed

+10
-16
lines changed

6 files changed

+10
-16
lines changed

client/src/client-only-routes/show-update-email.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Link } from 'gatsby';
21
import React, {
32
useState,
43
useEffect,
@@ -21,7 +20,7 @@ import {
2120
} from '@freecodecamp/ui';
2221

2322
import envData from '../../config/env.json';
24-
import { Spacer, Loader } from '../components/helpers';
23+
import { Spacer, Loader, Link } from '../components/helpers';
2524
import './show-update-email.css';
2625
import { isSignedInSelector, userSelector } from '../redux/selectors';
2726
import { hardGoTo as navigate } from '../redux/actions';

client/src/components/FourOhFour/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { RouteComponentProps } from '@reach/router';
2-
import { Link } from 'gatsby';
32
import React from 'react';
43
import Helmet from 'react-helmet';
54
import { useTranslation } from 'react-i18next';
65

76
import notFoundLogo from '../../assets/images/freeCodeCamp-404.svg';
87
import { randomQuote } from '../../utils/get-words';
9-
import { Spacer } from '../helpers';
8+
import { Spacer, Link } from '../helpers';
109

1110
import './404.css';
1211

client/src/components/helpers/button-link.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
2-
import { Link as GatsbyLink } from 'gatsby';
32
import { Button } from '@freecodecamp/ui';
43

4+
import Link from './link';
5+
56
export type ButtonSize = 'small' | 'medium' | 'large';
67

78
interface Props extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
@@ -67,13 +68,8 @@ export const ButtonLink = ({
6768
}
6869

6970
return (
70-
<GatsbyLink
71-
className={gatsbyLinkCls}
72-
to={href}
73-
target={target}
74-
onClick={onClick}
75-
>
71+
<Link className={gatsbyLinkCls} to={href} target={target} onClick={onClick}>
7672
{children}
77-
</GatsbyLink>
73+
</Link>
7874
);
7975
};

client/src/components/settings/certification.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Link, navigate } from 'gatsby';
1+
import { navigate } from 'gatsby';
22
import { find } from 'lodash-es';
33
import React, { MouseEvent, useState } from 'react';
44
import { withTranslation } from 'react-i18next';
@@ -21,7 +21,7 @@ import {
2121
} from '../../../config/cert-and-project-map';
2222
import { FlashMessages } from '../Flash/redux/flash-messages';
2323
import ProjectModal from '../SolutionViewer/project-modal';
24-
import { FullWidthRow, Spacer } from '../helpers';
24+
import { FullWidthRow, Spacer, Link } from '../helpers';
2525
import { SolutionDisplayWidget } from '../solution-display-widget';
2626
import {
2727
Certification,

client/src/components/settings/email.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ControlLabel,
88
Button
99
} from '@freecodecamp/ui';
10-
import { Link } from 'gatsby';
1110
import React, { useState } from 'react';
1211
import type { TFunction } from 'i18next';
1312
import { Trans, withTranslation } from 'react-i18next';
@@ -22,6 +21,7 @@ import { maybeEmailRE } from '../../utils';
2221
import BlockSaveButton from '../helpers/form/block-save-button';
2322
import FullWidthRow from '../helpers/full-width-row';
2423
import Spacer from '../helpers/spacer';
24+
import Link from '../helpers/link';
2525
import SectionHeader from './section-header';
2626
import ToggleButtonSetting from './toggle-button-setting';
2727

client/src/templates/Introduction/components/challenges.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Link } from 'gatsby';
21
import React from 'react';
32
import { withTranslation, useTranslation } from 'react-i18next';
43

@@ -7,6 +6,7 @@ import GreenPass from '../../../assets/icons/green-pass';
76
import { ChallengeWithCompletedNode } from '../../../redux/prop-types';
87
import { SuperBlocks } from '../../../../../shared/config/curriculum';
98
import { challengeTypes } from '../../../../../shared/config/challenge-types';
9+
import { Link } from '../../../components/helpers';
1010
import { ButtonLink } from '../../../components/helpers/button-link';
1111

1212
const getStepNumber = (dashedName: string) => {

0 commit comments

Comments
 (0)