Skip to content

Commit 56f02ab

Browse files
committed
refactor: set default props of Link to custom link
1 parent 8b4b1db commit 56f02ab

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

src/components/Breadcrumbs/Breadcrumbs.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client';
22

3-
import { Link as NextLink } from '@/navigation';
43
import MuiBreadcrumbs from '@mui/material/Breadcrumbs';
54
import Link from '@mui/material/Link';
65
import type { FC } from 'react';
@@ -23,13 +22,7 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({ items }) => {
2322
{items.map((item) => {
2423
const href = '';
2524
return (
26-
<Link
27-
key={item.id}
28-
variant="body2"
29-
component={NextLink}
30-
underline="hover"
31-
href={href}
32-
>
25+
<Link key={item.id} variant="body2" underline="hover" href={href}>
3326
{item.title}
3427
</Link>
3528
);

src/components/Footer/components/DesktopFooter.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,9 @@ const Footer = () => {
3636
align="center"
3737
sx={{ display: 'flex', alignItems: 'center', gap: 2 }}
3838
>
39-
<Link component={NextLink} href="#">
40-
{t('footer.links.aboutUs')}
41-
</Link>
39+
<Link href="#">{t('footer.links.aboutUs')}</Link>
4240

43-
<Link component={NextLink} href="#">
44-
{t('footer.links.contactUs')}
45-
</Link>
41+
<Link href="#">{t('footer.links.contactUs')}</Link>
4642
</Typography>
4743
</Container>
4844
</Box>

src/components/Footer/components/MobileFooter.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import MuiBottomNavigation from '@mui/material/BottomNavigation';
1010
import BottomNavigationAction from '@mui/material/BottomNavigationAction';
1111
import Box from '@mui/material/Box';
1212
import { useTranslations } from 'next-intl';
13-
import { Link as NextLink } from '@/navigation';
1413
import { usePathname } from 'next/navigation';
1514
import { ReactNode } from 'react';
1615

@@ -64,7 +63,6 @@ const MobileFooter = () => {
6463
return (
6564
<BottomNavigationAction
6665
key={page.label}
67-
LinkComponent={NextLink}
6866
href={page.href}
6967
label={page.label}
7068
icon={page.icon}

src/components/Header/components/TopSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const TopSection: FC = () => {
5959
<>
6060
<Toolbar disableGutters>
6161
<Link
62-
component={NextLink}
6362
href="/"
6463
sx={{
6564
display: 'flex',

src/config/theme.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use client';
22

3-
import { createTheme, type GlobalStylesProps } from '@mui/material';
3+
import { Link } from '@/navigation';
4+
import {
5+
ThemeOptions,
6+
createTheme,
7+
type GlobalStylesProps,
8+
} from '@mui/material';
49
import { green, grey } from '@mui/material/colors';
510

611
export const globalStyles: GlobalStylesProps['styles'] = {
@@ -9,7 +14,7 @@ export const globalStyles: GlobalStylesProps['styles'] = {
914
},
1015
};
1116

12-
const themeOptions = {
17+
const themeOptions: ThemeOptions = {
1318
palette: {
1419
primary: {
1520
main: green[500],
@@ -19,6 +24,16 @@ const themeOptions = {
1924
borderRadius: 8,
2025
},
2126
components: {
27+
MuiLink: {
28+
defaultProps: {
29+
component: Link,
30+
},
31+
},
32+
MuiBottomNavigationAction: {
33+
defaultProps: {
34+
component: Link,
35+
},
36+
},
2237
MuiCard: {
2338
defaultProps: {
2439
elevation: 0,

0 commit comments

Comments
 (0)