Skip to content

Commit 7d682b4

Browse files
committed
refactor(frontend): link-refactor
1 parent 40c08db commit 7d682b4

File tree

34 files changed

+143
-230
lines changed

34 files changed

+143
-230
lines changed

frontend/src/app/for-lawyers/components/Hero.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from "react";
22

33
import clsx from "clsx";
44
import Image from "next/image";
5-
import Link from "next/link";
65

76
import Button from "@/components/Button";
7+
import CustomLink from "@/components/CustomLink";
88
import ExternalLink from "@/components/ExternalLink";
99
import { request } from "@/utils/graphQLClient";
1010

@@ -24,16 +24,11 @@ const Hero: React.FC = async () => {
2424
<p className="max-w-[685px] text-lg">{subtitle}</p>
2525
<div className="flex flex-wrap gap-6">
2626
{buttons.map((button) => (
27-
<Link
28-
key={button.text}
29-
href={button.link.url}
30-
target="_blank"
31-
rel="noopener noreferrer"
32-
>
27+
<CustomLink key={button.text} href={button.link.url}>
3328
<Button variant="secondary">
3429
<span>{button.text}</span>
3530
</Button>
36-
</Link>
31+
</CustomLink>
3732
))}
3833
</div>
3934
<ExternalLink

frontend/src/app/home/components/Hero.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from "react";
22

33
import Image from "next/image";
4-
import Link from "next/link";
54

65
import LinkArrow from "@/assets/svgs/icons/link-arrow.svg";
76
import Button from "@/components/Button";
7+
import CustomLink from "@/components/CustomLink";
88
import { request } from "@/utils/graphQLClient";
99

1010
import { HeroQueryType, heroQuery } from "../queries/hero";
@@ -26,33 +26,21 @@ const Hero: React.FC = async () => {
2626
<h1 className="text-2xl lg:text-3xl">{title}</h1>
2727
<p className="text-lg">{subtitle}</p>
2828
<div className="lg:hidden">
29-
<Link
30-
href={primaryButton.link.url}
31-
target="_blank"
32-
rel="noopener noreferrer"
33-
>
29+
<CustomLink href={primaryButton.link.url}>
3430
<Button>
3531
<span className="text-background-2"> {primaryButton.text} </span>
3632
</Button>
37-
</Link>
33+
</CustomLink>
3834
</div>
3935
<div>
40-
<Link
41-
href={secondaryButton.link.url}
42-
target="_blank"
43-
rel="noopener noreferrer"
44-
>
36+
<CustomLink href={secondaryButton.link.url}>
4537
<Button variant="secondary">
4638
<span>{secondaryButton.text}</span>
4739
</Button>
48-
</Link>
40+
</CustomLink>
4941
</div>
5042
<div>
51-
<Link
52-
href={arrowLink.link.url}
53-
target="_blank"
54-
rel="noopener noreferrer"
55-
>
43+
<CustomLink href={arrowLink.link.url}>
5644
<span className="mr-4">{arrowLink.text}</span>
5745
<Image
5846
src={LinkArrow}
@@ -61,7 +49,7 @@ const Hero: React.FC = async () => {
6149
alt="Arrow link image"
6250
className="inline"
6351
/>
64-
</Link>
52+
</CustomLink>
6553
</div>
6654
</div>
6755
<Image

frontend/src/app/home/components/LearnPosts.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from "react";
22

3-
import Link from "next/link";
4-
53
import CtaCard from "@/components/CtaCard";
4+
import CustomLink from "@/components/CustomLink";
65
import { request } from "@/utils/graphQLClient";
76

87
import {
@@ -34,12 +33,12 @@ const LearnPosts: React.FC = async () => {
3433
<p className="text-center text-base lg:text-lg">
3534
{introduction.heading_text}
3635
<br />
37-
<Link
36+
<CustomLink
3837
className="text-primary-blue"
3938
href={introduction.link.link.url}
4039
>
4140
{introduction.link.text}
42-
</Link>
41+
</CustomLink>
4342
<br />
4443
{introduction.closing_text}
4544
</p>

frontend/src/app/home/components/TrustedBy.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from "react";
22

33
import clsx from "clsx";
44
import Image from "next/image";
5-
import Link from "next/link";
65

6+
import CustomLink from "@/components/CustomLink";
77
import { request } from "@/utils/graphQLClient";
88

99
import { partnersQuery, PartnersQueryType } from "../queries/trusted-by";
@@ -33,20 +33,15 @@ const TrustedBy: React.FC = async () => {
3333
)}
3434
>
3535
{institutions.map(({ name, link, image }) => (
36-
<Link
37-
key={name}
38-
href={link.url}
39-
target="_blank"
40-
rel="noopener noreferrer"
41-
>
36+
<CustomLink key={name} href={link.url}>
4237
<Image
4338
src={image.url}
4439
alt={name}
4540
width="1"
4641
height="1"
4742
className="h-auto w-auto"
4843
/>
49-
</Link>
44+
</CustomLink>
5045
))}
5146
</div>
5247
</div>

frontend/src/components/BrandAssets/Hero.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from "react";
22

33
import Image from "next/image";
4-
import Link from "next/link";
54

65
import Button from "@/components/Button";
76
import { HeroQueryType } from "@/queries/brand-assets/hero";
87

8+
import CustomLink from "../CustomLink";
9+
910
interface IHero {
1011
heroData: HeroQueryType["brandAssetsPageHero"];
1112
}
@@ -17,15 +18,11 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
1718
<h1 className="w-min text-3xl">{heroData.header}</h1>
1819
<p className="text-lg">{heroData.subtitle}</p>
1920
<div>
20-
<Link
21-
href={heroData.button?.link?.url}
22-
target="_blank"
23-
rel="noopener noreferrer"
24-
>
21+
<CustomLink href={heroData.button?.link?.url}>
2522
<Button variant="secondary">
2623
<span>{heroData.button?.text}</span>
2724
</Button>
28-
</Link>
25+
</CustomLink>
2926
</div>
3027
</div>
3128
<Image

frontend/src/components/BrandAssets/LogosPackageSection.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import Link from "next/link";
2-
31
import { LogosPackageSectionQueryType } from "@/queries/brand-assets/logos-package-section";
42

53
import Button from "../Button";
4+
import CustomLink from "../CustomLink";
65
import ExternalLink from "../ExternalLink";
76

87
interface ILogosPackageSection {
@@ -17,17 +16,13 @@ const LogosPackageSection: React.FC<ILogosPackageSection> = ({
1716
<h1 className="w-min text-3xl">{logosPackageData.header}</h1>
1817
<p className="text-lg text-secondary-text">{logosPackageData.subtitle}</p>
1918
<div>
20-
<Link
21-
href={logosPackageData.button?.link?.url}
22-
target="_blank"
23-
rel="noopener noreferrer"
24-
>
19+
<CustomLink href={logosPackageData.button?.link?.url}>
2520
<Button variant="primary">
2621
<span className="text-background-2">
2722
{logosPackageData.button?.text}
2823
</span>
2924
</Button>
30-
</Link>
25+
</CustomLink>
3126
</div>
3227
<ExternalLink
3328
url={logosPackageData.arrowLink.link.url}

frontend/src/components/Community/CommunityCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import Image from "next/image";
2-
import Link from "next/link";
32

43
import { Community } from "@/queries/community/hero";
54

5+
import CustomLink from "../CustomLink";
6+
67
const CommunityCard: React.FC<Community> = ({ title, subtitle, icon, url }) => {
78
return (
8-
<Link href={url} target="_blank" rel="noreferrer noopener">
9+
<CustomLink href={url}>
910
<div className="flex min-h-[326px] flex-col items-center justify-center rounded-2xl border border-stroke bg-background-2 hover:scale-[1.01]">
1011
<Image
1112
src={icon.url}
@@ -19,7 +20,7 @@ const CommunityCard: React.FC<Community> = ({ title, subtitle, icon, url }) => {
1920
</h2>
2021
<label className="text-base text-secondary-text">{subtitle}</label>
2122
</div>
22-
</Link>
23+
</CustomLink>
2324
);
2425
};
2526

frontend/src/components/Community/hero.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from "react";
22

33
import Image from "next/image";
4-
import Link from "next/link";
54

65
import Button from "@/components/Button";
76
import { HeroQueryType } from "@/queries/community/hero";
87

8+
import CustomLink from "../CustomLink";
9+
910
interface IHero {
1011
heroData: HeroQueryType["communityPageHero"];
1112
}
@@ -21,16 +22,11 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
2122
<p className="text-lg">{subtitle}</p>
2223
<div className="flex flex-wrap items-center gap-6">
2324
{communityButtons.map((button) => (
24-
<Link
25-
key={button.text}
26-
href={button.link.url}
27-
target="_blank"
28-
rel="noopener noreferrer"
29-
>
25+
<CustomLink key={button.text} href={button.link.url}>
3026
<Button variant="secondary">
3127
<span>{button.text}</span>
3228
</Button>
33-
</Link>
29+
</CustomLink>
3430
))}
3531
</div>
3632
</div>

frontend/src/components/Cooperative/ReportSection/ReportCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { useState } from "react";
44

55
import clsx from "clsx";
66
import Image from "next/image";
7-
import Link from "next/link";
87

98
import Button from "@/components/Button";
9+
import CustomLink from "@/components/CustomLink";
1010
import { Report } from "@/queries/cooperative/report-section";
1111

1212
import DropdownContainer from "./DropdownContainer";
@@ -53,15 +53,15 @@ const ReportCard: React.FC<IReportCard> = ({
5353
}}
5454
/>
5555

56-
<Link href={reportUrl ?? ""} target="_blank" rel="noreferrer noopener">
56+
<CustomLink href={reportUrl ?? ""}>
5757
<Button
5858
variant="primary"
5959
className="text-background-1"
6060
disabled={typeof reportUrl === "undefined"}
6161
>
6262
{downloadButtonText}
6363
</Button>
64-
</Link>
64+
</CustomLink>
6565
</div>
6666

6767
<div

frontend/src/components/Cooperative/hero.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from "react";
22

33
import Image from "next/image";
4-
import Link from "next/link";
54

65
import Button from "@/components/Button";
76
import ExternalLink from "@/components/ExternalLink";
87
import { HeroQueryType } from "@/queries/cooperative/hero";
98

9+
import CustomLink from "../CustomLink";
10+
1011
interface IHero {
1112
heroData: HeroQueryType["cooperativePageHero"];
1213
}
@@ -22,16 +23,11 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
2223
<p className="max-w-[685px] text-lg">{subtitle}</p>
2324
<div className="flex flex-wrap items-center gap-6">
2425
{buttons.map((button) => (
25-
<Link
26-
key={button.text}
27-
href={button.link.url}
28-
target="_blank"
29-
rel="noopener noreferrer"
30-
>
26+
<CustomLink key={button.text} href={button.link.url}>
3127
<Button variant="secondary">
3228
<span>{button.text}</span>
3329
</Button>
34-
</Link>
30+
</CustomLink>
3531
))}
3632
</div>
3733
<ExternalLink

0 commit comments

Comments
 (0)