Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: url path for reference document links #29

Merged
merged 2 commits into from
Jul 24, 2023
Merged

Conversation

binoy14
Copy link
Contributor

@binoy14 binoy14 commented Jul 24, 2023

No description provided.

@binoy14 binoy14 requested a review from rexxars July 24, 2023 18:24
@@ -175,17 +175,19 @@ function Link(props: PortableTextMarkComponentProps) {
const {packageName, exportPath} = params
const url = value?.['href']
const isExternalUrl = isValidUrl(url)
const href = isExternalUrl ? url : getInternalHref({url, basePath, packageName, exportPath})
const path = !isExternalUrl && getInternalHref({url, basePath, packageName, exportPath})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this better?

Suggested change
const path = !isExternalUrl && getInternalHref({url, basePath, packageName, exportPath})
const path = isExternalUrl ? undefined : getInternalHref({url, basePath, packageName, exportPath})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough - although basePath isn't used in getInternalHref anymore, so should probably remove it.

@@ -175,17 +175,19 @@ function Link(props: PortableTextMarkComponentProps) {
const {packageName, exportPath} = params
const url = value?.['href']
const isExternalUrl = isValidUrl(url)
const href = isExternalUrl ? url : getInternalHref({url, basePath, packageName, exportPath})
const path = !isExternalUrl && getInternalHref({url, basePath, packageName, exportPath})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough - although basePath isn't used in getInternalHref anymore, so should probably remove it.

@binoy14 binoy14 merged commit 0674595 into alpha Jul 24, 2023
@binoy14 binoy14 deleted the fix/reference-urls branch July 24, 2023 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants