Skip to content

Commit

Permalink
Spread props to multiple rows to fix prettier error
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroSilenius committed Oct 31, 2022
1 parent 44366cb commit d24f393
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
23 changes: 21 additions & 2 deletions examples/nextjs-with-typescript/src/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ interface NextLinkComposedProps

export const NextLinkComposed = React.forwardRef<HTMLAnchorElement, NextLinkComposedProps>(
function NextLinkComposed(props, ref) {
const { to, linkAs, replace, scroll, shallow, prefetch, legacyBehavior = true, locale, ...other } = props;
const {
to,
linkAs,
replace,
scroll,
shallow,
prefetch,
legacyBehavior = true,
locale,
...other
} = props;

return (
<NextLink
Expand Down Expand Up @@ -84,7 +94,16 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props,
}

const linkAs = linkAsProp || as;
const nextjsProps = { to: href, linkAs, replace, scroll, shallow, prefetch,legacyBehavior, locale };
const nextjsProps = {
to: href,
linkAs,
replace,
scroll,
shallow,
prefetch,
legacyBehavior,
locale,
};

if (noLinkStyle) {
return <NextLinkComposed className={className} ref={ref} {...nextjsProps} {...other} />;
Expand Down
23 changes: 21 additions & 2 deletions examples/nextjs/src/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ import { styled } from '@mui/material/styles';
const Anchor = styled('a')({});

export const NextLinkComposed = React.forwardRef(function NextLinkComposed(props, ref) {
const { to, linkAs, replace, scroll, shallow, prefetch, legacyBehavior = true, locale, ...other } = props;
const {
to,
linkAs,
replace,
scroll,
shallow,
prefetch,
legacyBehavior = true,
locale,
...other
} = props;

return (
<NextLink
Expand Down Expand Up @@ -80,7 +90,16 @@ const Link = React.forwardRef(function Link(props, ref) {
}

const linkAs = linkAsProp || as;
const nextjsProps = { to: href, linkAs, replace, scroll, shallow, prefetch, legacyBehavior, locale };
const nextjsProps = {
to: href,
linkAs,
replace,
scroll,
shallow,
prefetch,
legacyBehavior,
locale,
};

if (noLinkStyle) {
return <NextLinkComposed className={className} ref={ref} {...nextjsProps} {...other} />;
Expand Down

0 comments on commit d24f393

Please sign in to comment.