Skip to content

Commit 5b33f82

Browse files
committed
Logic for absolute URLs in the case where we link outside of docs
1 parent 8184bf3 commit 5b33f82

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

documentation/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ QuestDB Enterprise offers everything from open source, plus additional features
6161
for running QuestDB at greater scale or significance.
6262

6363
<div className="not-prose">
64-
<DocButton href="/enterprise/" variant="text" arrow="right">
64+
<DocButton href="/enterprise/" absolute variant="text" arrow="right">
6565
<>Learn more</>
6666
</DocButton>
6767
</div>

src/components/DocButton/index.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const variantStyles = {
2929
type ButtonProps = {
3030
variant?: keyof typeof variantStyles
3131
arrow?: 'left' | 'right'
32+
absolute?: boolean
3233
} & (
3334
| React.ComponentPropsWithoutRef<typeof Link>
3435
| (React.ComponentPropsWithoutRef<'button'> & { href?: undefined })
@@ -39,6 +40,7 @@ export function DocButton({
3940
className,
4041
children,
4142
arrow,
43+
absolute,
4244
...props
4345
}: ButtonProps) {
4446
className = clsx(
@@ -79,6 +81,14 @@ export function DocButton({
7981
)
8082
}
8183

84+
if (absolute && props.href?.startsWith('/')) {
85+
return (
86+
<a className={className} {...props}>
87+
{inner}
88+
</a>
89+
)
90+
}
91+
8292
return (
8393
<Link className={className} {...props}>
8494
{inner}

0 commit comments

Comments
 (0)