forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Link.js
27 lines (23 loc) · 741 Bytes
/
Link.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as React from 'react'
import NextLink from 'next/link'
import MuiLink from '@mui/material/Link'
import { styled } from '@mui/material/styles'
// Add support for the sx prop for consistency with the other branches.
const Anchor = styled(NextLink)({})
export const NextLinkComposed = React.forwardRef(function NextLinkComposed(
props,
ref
) {
const { children, ...rest } = props
return (
<Anchor href="/" ref={ref} {...rest}>
{children}
</Anchor>
)
})
// A styled version of the Next.js Link component:
// https://nextjs.org/docs/api-reference/next/link
const Link = React.forwardRef(function Link(props, ref) {
return <MuiLink component={NextLinkComposed} ref={ref} {...props} />
})
export default Link