Skip to content

Commit

Permalink
support empty link with text
Browse files Browse the repository at this point in the history
  • Loading branch information
xrutayisire committed Sep 7, 2024
1 parent 205fb87 commit 7074630
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/PrismicNextLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const PrismicNextLink = React.forwardRef<
});

const href = ("href" in restProps ? restProps.href : computedHref) || "";
const text = prismic.isFilled.link(field) ? field.text : undefined;

let rel = computedRel;
if ("rel" in restProps && typeof restProps.rel !== "function") {
Expand All @@ -52,7 +51,7 @@ export const PrismicNextLink = React.forwardRef<

return (
<Link ref={ref} {...attrs} {...restProps} href={href} rel={rel}>
{"children" in props ? children : text}
{"children" in props ? children : field?.text}

Check failure on line 54 in src/PrismicNextLink.tsx

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 16, TS 4.6)

Property 'text' does not exist on type 'FilledContentRelationshipField<string, string, unknown> | EmptyLinkField<"Any"> | FilledLinkToWebField | FilledLinkToMediaField'.

Check failure on line 54 in src/PrismicNextLink.tsx

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 16, TS 4.7)

Property 'text' does not exist on type 'FilledContentRelationshipField<string, string, unknown> | EmptyLinkField<"Any"> | FilledLinkToWebField | FilledLinkToMediaField'.

Check failure on line 54 in src/PrismicNextLink.tsx

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 16, TS 4.8)

Property 'text' does not exist on type 'FilledContentRelationshipField<string, string, unknown> | EmptyLinkField<"Any"> | FilledLinkToWebField | FilledLinkToMediaField'.

Check failure on line 54 in src/PrismicNextLink.tsx

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 16, TS 4.9)

Property 'text' does not exist on type 'FilledContentRelationshipField<string, string, unknown> | EmptyLinkField<"Any"> | FilledLinkToWebField | FilledLinkToMediaField'.

Check failure on line 54 in src/PrismicNextLink.tsx

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 16, TS 5.0)

Property 'text' does not exist on type 'LinkField'.
</Link>
);
});

0 comments on commit 7074630

Please sign in to comment.